From: Hal Fulton Date: 2006-08-14T04:11:36+09:00 Subject: Re: PATCH to make internal Hash class retain order... Daniel Schierbeck wrote: > 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