From: Mark Abramov Date: 2010-06-11T01:00:49+09:00 Subject: Re: comparing objects Marcin Wolski wrote: > Rein Henrichs wrote: >> On 2010-06-10 07:20:03 -0700, Mark Abramov said: >> >>> Mark Abramov wrote: >>>> [tl;dr] >>> >>> Sorry, guys, didn't notice how I used eql instead of eql? >>> Btw, without #hash it won't work anyways which I consider *weird* at the >>> very least. >> >> #hash makes sense for Hash#[] and etc. #eql? makes more sense for >> Array#&. I too find it odd that both are necessary. > > If two objects are set to be eql?, their hash methods must also return > the same value. More details in The Ruby Programming Language book. > > Thus, when you redefine eql?, the hash methods also should be redefined. http://ruby-doc.org/core-1.8.7/classes/Object.html#M000617 Well, it doesn't say much in core api :( -- Posted via http://www.ruby-forum.com/.