[Newbies] reimplementing #= and #hash
oscar.nierstrasz at gmail.com
Sun Sep 23 09:27:41 UTC 2007
#hash should be reimplemented to make sure that objects considered to
be equal will end up in the same hash bucket.
The usual trick is to take a bitXor of the hashes of the instance
^ member hash bitXor: processor hash
Hope that helps.
On Sep 23, 2007, at 9:52, Ching de la Serna wrote:
> Hi List,
> I have a Class PoolQueue which has instvars 'member' and
> 'processor'. I find that an instance of PoolQueue when placed in an
> OrderedCollection can no longer be considered equal. I suppose I
> have to reimplement #= and #hash to allow PoolQueue instances to be
> My problem: how do I implement #hash? Or stated another way, what
> does #hash accomplish?
> Thanks in advance.
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners