[Enh] Simple equality

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Enh] Simple equality

Noury Bouraqadi-2
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