"Tim Sutherland" <timsuth / ihug.co.nz> schrieb im Newsbeitrag 
news:slrnctvdsn.hpb.timsuth / europa.zone...
> In article <d563731905010802175d37f678 / mail.gmail.com>, Matt Mower wrote:
>>On Sat, 8 Jan 2005 10:00:58 +0000, Matt Mower <matt.mower / gmail.com> 
>>wrote:
>>> Hi Traz,
>>>
>>> On Sat, 8 Jan 2005 17:51:25 +0900, Traz <A.Reith / gmail.com > wrote:
>>> > >Because Hash uses Object#eql? to test for equality it makes them
>>> > >different keys and hence your example fails.
>>> >
>>> > Matt, string keys have the same behaviour, no ? :
>>> > >> "one".object_id
>>> > => 22476232
>>> > >> "one".object_id
>>> > => 22473868
>>> >
>>>
>>> I think the answer here is that String redefines the eql? method to
>>> compare content instead of 'object_id' so String literal keys will
>>> work.
>>>
>>
>>Hmm... except that I tried a naive redefinition of Hash#eql? to:
>>
>>def eql?( o ); self == o; end;
>>
>>and the example still doesn't work.  Guess I'm just wrong ;-)
>
> You also need to define Hash#hash so that eql objects have the same hash
> code.

Note also that equivalence of Hashes is not a simple concept: in some 
situations you want to include the default value and / or block into 
equivalence and sometimes you don't.  I guess that's the reason why this was 
left open for quite some time.  The most pragmatic solution is to define 
hashes with the same key value pairs, the same default value and without a 
block to be equivalent and all others to not be equivalent.

Kind regards

    robert