RFR: 8338529: Initial iteration of numerics modeling interfaces [v3]

Joe Darcy darcy at openjdk.org
Sat Jan 17 01:15:22 UTC 2026


On Sat, 17 Jan 2026 01:00:41 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> I’m not sure what the intended design rules are here, but for anything algebraic, fewer axioms are much better than more (murkily related) axioms. Having many abstract interface points is the same as many axioms — the witnesses each have their own story for each API point independently.
> 
> The default method approach is very wise, and the body of the default should be in an implnote in the docs. It amounts to a proof that shows how to (e.g.) deduce min and max from lower-level axioms.

One of the implicit design question here is "are these the interfaces that allow operator overloading?" or "are these the interfaces that declare various algebraic properties?"

Since many of the numerical types of possible interest are closer to, say, floating-point-like types that have few algebraic properties rather than integer-like types that have more, I don't want to preclude floating-point-like types from participating in operator overloading because of their lack of strong algebraic properties. Matrices/vectors would also fall closer to floating-point-like rather than integer-like and I would not want to preclude matrices/vectors from benefiting from operators.

I included a slide in my 2025 JVMLS talk on numerics speculating that a future refinement of these kinds of interfaces could include an idiom to indicate "yes, this type actually obeys the ring axioms" or "... the field axioms", etc., but that is not included in this early "lumpy" iteration.

I would fully expect some evolution of the set of interfaces, what methods go where, the set of interfaces, etc. as we can more experience using these trial types with type classes.

Thanks.

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/1917#discussion_r2700497372


More information about the valhalla-dev mailing list