H
Hal Fulton
Daniel said:This is a question that has been raised during an earlier discussion of
this issue: What should this expression return?
{:foo => 1, :bar => 2} == {:bar => 2, :foo => 1}
I don't think there's any way around it returning `true', but that would
decrease the usefulness of ordered hashes. One solution would be that
Hash#== returns true in such cases while Hash#eql? returns false, just as
2 == 2.0 => true
2.eql? 2.0 => false
I once discussed this with Matz, and he said that two hashes
with the same key-value pairs would still be equal (if we
implemented an ordered hash, which is a big "if").
That doesn't bother me as long as I can iterate. I could
still do:
h1.to_a == h2.to_a
to check equality with order taken into account.
Hal