[Pharo-project] Burning the disk packs: Who puts equality into Object?

Diego Gomez Deck diegogomezdeck at consultar.com
Wed Sep 24 09:30:22 EDT 2008

Hi guys,

I recently discovered Pharo project and I'd like to fire a proposal for
cleaning Object class.

The "simple" idea is to remove equality concept (implemented with #= and
#hash messages) from Object.

Equality means that different instances  can represent the same value
(like Numbers, Strings, Dates, etc).  Identity means that any object is
a different object from any other from the world.

All objects have identity (#== and #basicHash messages), but not all
object share the equality concept.  To make the things worst, the
default implementation of equality is based on the identity, producing a
big confusion to newbies (and experts too!).

One implementation option is to implement the Equality concept in a
super-class of Magnitude (Comparable?), and reused all over the class
hierarchy with traits.

Of course such factorization will impact also on the Collections that
(most of them) also confuses equality with identity. Probably some
collections will need an Strategy-pattern to use identity or equality
based behavior.

What do you think?


-- Diego

More information about the Pharo-dev mailing list