[Newbies] reimplementing #= and #hash
Ching de la Serna
ching.dls at gmail.com
Mon Sep 24 00:38:20 UTC 2007
Thanks for the help. I tried bitAnd: and it seems to work. I will try
bitXor: too. Thanks
On 9/23/07, Oscar Nierstrasz <oscar.nierstrasz at gmail.com> wrote:
> Hi Ching,
> #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
> > compared.
> > My problem: how do I implement #hash? Or stated another way, what
> > does #hash accomplish?
> > Thanks in advance.
> > Ching.
> > _______________________________________________
> > Beginners mailing list
> > Beginners at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners