acmp again !

Brian Goetz brian.goetz at oracle.com
Thu Feb 21 01:48:09 UTC 2019


>
> It doesn't match my experience, currently people have no expectation of what == means on a value type, if you explain that a value type has no identity, that == doesn't work on a value type, most people are ok with that.

I think this is fantasy.

Value types are OBJECTS.  People think they know what == means on an 
Object, and for most users, the word "identity" does not come to mind.  
Further, we've told people that "values have only state, no identity -- 
if two values have the same state, they are the same." For such values 
not to be == will be astonishing.

Consider:

      value class UnsignedInt {
         public static UnsignedInt ZERO = ...

         private int i;

         public static add(UnsignedInt a, UnsignedInt b) { ... }
     }

     UnsignedInt x = ...
     if (x != UnsignedInt.ZERO) { ... }

People will never, ever, ever get used to the idea that test is always 
false.  Its a fantasy to think otherwise.  And the WHOLE POINT of 
L-World is to allow people to not sweat the small details between values 
and refs.  This is asking them to be acutely aware all the time.





More information about the valhalla-spec-observers mailing list