From: Eric Hodel Date: 2006-06-27T06:28:55+09:00 Subject: Re: Ruby and Java equality usage On Jun 26, 2006, at 4:38 AM, Alexandru Popescu wrote: > I have posted a quick (reminder like) entry about how equality is > handled by Ruby and Java: > > http://themindstorms.blogspot.com/2006/06/parallel-of-equality-in-2- > worlds-ruby.html > > However, I feel I have missed to explain correctly why eql? and == > are both needed. #eql? is used to resolve key collisions in hashes. If two objects have the same #hash and are #eql? then they refer to the same hash key. If two objects have the same #hash and are not #eql? they refer to different hash keys. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com