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

John R Rose jrose at openjdk.org
Sat Jan 17 00:03:45 UTC 2026


On Fri, 16 Jan 2026 20:47:13 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> 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.
>
>> 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.
> 
> PS Pushed another changeset refactoring to have less than be the base operation and using default methods for the rest.

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.

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

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


More information about the valhalla-dev mailing list