[Pharo-project] [Enh] Simple equality

Noury Bouraqadi bouraqadi at gmail.com
Sat Feb 5 09:58:29 CET 2011


Hi,

Each time I have to explain to my students that to when overriding = they should override hash, I find it awkward.
Now I got the idea to ease this process and avoid having to implement = and hash in simple cases.
To make instances of some class comparable, simply make the class use one trait (TEquality).

For most other cases, simply one method need to be overridden (valuesToCompareForEquality).
I put the code (with tests) on the issue tracker 
http://code.google.com/p/pharo/issues/detail?id=3657

Note that for the default implementation of hash, I reused the code from SequenceableCollection.

Feedback is as usual welcome :-)
Noury





More information about the Pharo-project mailing list