Value equality

John Rose john.r.rose at oracle.com
Wed May 18 23:01:37 UTC 2016


>> 
>> 
>> 
On May 18, 2016, at 3:58 PM, John Rose <john.r.rose at oracle.com> wrote:

Yes but if CE is a subset of OE then their union is just OE.  (Viewing relations as sets of pairs.)  In your example that is the case. Any .equals method must extend CE or it breaks the .equals contract. 

– John

> On May 18, 2016, at 3:52 PM, Remi Forax <forax at univ-mlv.fr> wrote:
> 
> Even without talking about optimizations,
> LIFE for a value type is not correct because CE may not be included in EQ.
> 
> value class Foo {
> int value;
> 
> public boolean equals(Foo foo) {
>   return value & 0xFF == foo.value & 0xFF;
> }
> }
> 
> here, if CE do a bitwise comparaison, the semantics of LIFE is not the semantics of EQ.
> 
> Rémi


More information about the valhalla-spec-observers mailing list