Simplifying 'value' and 'identity'

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Dec 18 11:06:51 UTC 2023


> But I've come around to the idea that a simple "all classes are identity by default" rule is good, and that the binary compatibility commitment associated with "value" (e.g., the class will never add a mutable field) is better stated explicitly.
I agree with this - it makes the mental map so much easier!
>
>> (For awhile, I was considering keeping around the 'identity' keyword, just for the purpose of interfaces. But, eh, nobody is going to use it.)
> One problem I noticed with a two-state interfaces approach is that interfaces need to be "value interfaces" by default, but we probably don't want to allow a "value interface" to extend an "identity interface", because in this iteration 'value' is an assertion about supertypes. (In contrast to the 3-state case, where it was fine to allow an "unconstrained interface" to extend an "identity interface".)

Yep, allowing a class to implement a mix of value and non-value 
interface seems messy - saying that all interfaces are "value" seems 
much better.

Maurizio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-experts/attachments/20231218/514ca974/attachment.htm>


More information about the valhalla-spec-experts mailing list