Thomas B. pisze:
> Marcin Mielyski wrote:
>> 1.8.7 and 1.9.x use deep hashing for hashes, to achieve that in 1.8.6
>> you need to monkey patch Hash: http://pastie.org/pastes/272194
> 
> So I believe this is sort of a bug in the old version? Because now I can 
> even get to this absurd:
> 
> irb(main):007:0> z={a[0]=>:x,a[1]=>:y}
> => {{"aa"=>"bb"}=>:x, {"aa"=>"bb"}=>:y} # absurd number 1
> irb(main):008:0> z[{"aa"=>"bb"}]
> => nil # absurd number two
> 
> with the three {"aa"=>"bb"} object still reported to be ==.
> 

It's not an absurd, just a consequence Hash doesn't have it's own hash 
(just default Object#hash). I agree it's a bit surprising but deep 
hashing is slower by a fair amount.

Comparison function will not even be called here since it fails earlier, 
at hash bucket lookup:

a = {"aa"=>"bb"}
b = {"aa"=>"bb"}
a.hash != b.hash

Btw, Hash doesn't use "==" for object comparison, it uses "eql?"

lopex