On Wednesday, 18 April 2012 at 05:09:55 UTC, H. S. Teoh wrote:
- Built-in reference types (pointers, refs, arrays) must be
either
tail-immutable, or the tail must be a struct or class (i.e.,
the user
is allowed to use arrays of unqualified objects with custom
toHash and
opEquals as AA keys).
This should allow the "nice" properties we can get from having
the type
system enforce key immutability, for simple key types, and
still allow
users to do complex stuff (define their own toHash/opEquals
that ignore
parts of the object) when they need to.
T
I'm not sure I got that part.
But for the rest, I tend to agree.
Actually, it's how it's done in Java: the Object class from which
derive all the other classes, has an equals() and an hashCode()
method. Of course these methods can be overriden.
http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html