hash method

stéphane ducasse ducasse at iam.unibe.ch
Fri Jul 1 10:26:38 UTC 2005


Generally

I use

     iv hash bitXor: iv2 hash

Following Kent beck best practices

But now I learned that I want to avoid as much as possible to  
redefine = and hash
and if this is just to sorted objects I used
SortedCollection sortBlock: [:a :b| a iv > b iv] for example.

I think that identity related issues is one of the most complex in OO  
Design.

Stef

Le 1 juil. 05 à 11:04, Houssam Fakih a écrit :

> Hi,
>
>
> When I redefine the = operation for a class I should redefine its  
> hash method.
>
> My question is about the definition of the hash method. I read that  
> the method must return a SmallInteger whose value is related to the  
> receiver. I would like to know if there is a general pattern  
> adopted in Squeak for that. I get a look in the Squeak classes but  
> it doesn’t help.
>
>
> Thanks,
>
> Houssam
>
> ____
>
> "Le paradis touche les pieds des mères..."
>
> >>> http://csl.ensm-douai.fr/fakih
>
>
>
>




More information about the Squeak-dev mailing list