I think you redefine hash to allow a Set to know if two objects are
the same or not.
So it's not an equals but it's a way for a Set to know if an
equivalent element is already on a Set or not.
Correct me if i'm wrong.

On 26 May 2015 at 20:45, Julien Delplanque <jul...@tamere.eu> wrote:
> The subject of this mail is exactly my question.
>
> I came to this question by looking at Object>>#= message implementation.
>
> """
> = anObject
>     "Answer whether the receiver and the argument represent the same
>     object. If = is redefined in any subclass, consider also redefining the
>     message hash."
>
>     ^self == anObject
> """
>
> When do we need to redefine #hash message?
>
> Is it the right way to implement equality between two objects or is there
> another message that I should override?
>
> Regards,
> Julien
>



-- 
Cheers
Cyril Ferlicot

Reply via email to