From: Matt Mower Date: 2005-01-08T23:45:53+09:00 Subject: Re: Strange behavior of hash key Hi Tim, On Sat, 8 Jan 2005 19:36:26 +0900, Tim Sutherland wrote: > >Hmm... except that I tried a naive redefinition of Hash#eql? to: > > > >def eql?( o ); self == o; end; > > > >and the example still doesn't work. Guess I'm just wrong ;-) > > You also need to define Hash#hash so that eql objects have the same hash > code. > Of course, I got sidetracked by eql? and forgot that the problem was, ultimately, about the hashing function. The real answer was in the difference between Object#hash which presumably uses object_id and String#hash which uses length & content. Thanks for putting me straight, Matt -- Matt Mower :: http://matt.blogs.it/