J
Joel VanderWerf
The ri docs for Object#eql? say:
The +eql?+ method returns +true+ if _obj_ and _anObject_ have the
same value. Used by +Hash+ to test members for equality.
However, the second sentence doesn't seem to be consistent with the
behavior of Hash (and Set):
h1 = {1=>2, 3=>4}
h2 = {1=>2, 3=>4}
p h1.eql?(h2) # ==> true
h={h1=>true}
p h[h1] # ==> true
p h[h2] # ==> nil
Based on the docs, I would have expected
p h[h2] # ==> true
Have I misunderstood?
The +eql?+ method returns +true+ if _obj_ and _anObject_ have the
same value. Used by +Hash+ to test members for equality.
However, the second sentence doesn't seem to be consistent with the
behavior of Hash (and Set):
h1 = {1=>2, 3=>4}
h2 = {1=>2, 3=>4}
p h1.eql?(h2) # ==> true
h={h1=>true}
p h[h1] # ==> true
p h[h2] # ==> nil
Based on the docs, I would have expected
p h[h2] # ==> true
Have I misunderstood?