From: Robert Klemme Date: 2010-06-12T01:47:16+09:00 Subject: Re: comparing objects On 10.06.2010 18:27, Robert Dober wrote: > On Thu, Jun 10, 2010 at 6:10 PM, Robert Klemme > wrote: > >> http://blog.rubybestpractices.com/posts/rklemme/018-Complete_Class.html >> http://blog.rubybestpractices.com/posts/rklemme/019-Complete_Numeric_Class.html > I > You define #eql? and #hash for your convenience. So good, so bad. My > question simply was: Show my why *not* redefining #hash and #eql? will > cause problems, because that was Wilson's statement. I am still > waiting :(. The advice to implement #eql? and #hash really only makes sense if equivalence can reasonably be defined for a class and if instances of that class should be used as Hash keys or in Set. If not at least equivalence can be defined other than via identity (which is the default) then it is perfectly reasonable to not override both methods and go with the default implementation. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/