valhalla-dev Digest, Vol 7, Issue 24
simon at ochsenreither.de
Fri Jan 9 16:37:19 UTC 2015
> As a possible implementation strategy:
> - have == simply translate to invocation of .equals() for values
> - have compiler/VM generate componentwise equals/hashCode
> - maybe, or maybe not, permit developer to override said equals
The combination of 1 and 3 sounds terrible, imho. :-)
a) Until now, people could expect that == had a fixed, non-changeable
interpretation. With that strategy, it could do arbitrary things.
b) Additionally it conflates two different concepts: Low-level identity
and high-level equality.
c) Plus, with references we had to worry whether equals was implemented
or was just using the default implementation of pointer identity. With
that strategy we would create the reverse problem: Using ==, we would
have to wonder whether it was just the default implementation or someone
What's wrong with the strategy I proposed earlier?
More information about the valhalla-dev