From: Andrew Walrond Date: 2005-05-05T23:22:11+09:00 Subject: Re: Whats so different about a Hash? On Thursday 05 May 2005 13:54, Florian Gro� wrote: > > I guess you can workaround it like this: > > class Hash > def hash() > [self.to_a, self.class].hash > end > end > > Though I am not sure if that is the correct semantics. (It could be the > case that Hash#eql?() also compares default values.) Is Hash#to_a guaranteed to sort the elements? My tests show that it does, but perhaps .to_a.sort might be safer? So I propose class Hash def hash() [self.to_s.sort,self.class].hash end def eql?(other) self.hash === other.hash end end to consolidate behaviour across ruby versions. Does that look right to you? (I'm not worked about the default value) Andrew