From: Robert Dober Date: 2006-06-26T21:01:55+09:00 Subject: Re: Ruby and Java equality usage ------=_Part_47285_22758329.1151323312255 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 6/26/06, Alexandru Popescu wrote: > > Hi! > > 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-world= s-ruby.html > > However, I feel I have missed to explain correctly why eql? and =3D=3D > are both needed (and I've been reading through Ruby books and searched > the ruby mailing list). Maybe somebody can clarify it and give a > better example. I will be happy to update the entry to reflect the > "new" knowledge. I am surprised you did not find this reference, possibly I missed a point i= n your mail http://www.ruby-doc.org/core/classes/Object.html#M001416 if I interpret it correctly =3D=3D is supposed to be redefined in classes in order to reflect identity = on an "application" level. equal? shall not be redefined in order to be available for object identity, something like a.equal?(b) iff a.object_id =3D=3D b.object_id eql? is used for Hash entry comparison and is not redefined most of the tim= e Just citing ruby doc for those who do not want to follow the link ;) Cheers Robert ./alex > -- > .w( the_mindstorm )p. > --- > (http://themindstorms.blogspot.com) > > --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_47285_22758329.1151323312255--