RFR: 8338529: Initial iteration of numerics modeling interfaces
Joe Darcy
darcy at openjdk.org
Fri Jan 16 18:21:24 UTC 2026
On Fri, 16 Jan 2026 16:50:30 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> A refinement of some earlier ideas on the numerics modeling interfaces to inform further discussions.
>>
>> This is a "lumpy" rather than "splitty" design in terms of favoring a smaller number of interfaces with more functionality rather than a larger number of interfaces making smaller distinctions.
>>
>> Various design comments and to-do's noted in the code.
>
> src/java.base/share/classes/java/lang/Orderable.java line 95:
>
>> 93: * @param op2 the second operand
>> 94: */
>> 95: OC min(OC op1, OC op2);
>
> Should this be a default method?
I wasn't sure if min/max should be included in the interface. I think it depends what role any non-operator methods have in interfaces intended for witnesses.
However, as long as the methods are here, they could be default methods, yes.
To acknowledge some feedback received on a different channel, if the OC type variable were required to extend Comparable, then all the lessThan, greaterThan, etc. method could have default methods written in terms of the results of compareTo. However, if we want to move away from Comparable, then extended its usage here probably isn't a good idea.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1917#discussion_r2699523484
More information about the valhalla-dev
mailing list