Thanks Robert. I have used that information and I am even linking to
it. The problem I was facing was to explain why == and eql? are both
needed, and when their implementation may be different.

./alex
--
.w( the_mindstorm )p.
---
(http://themindstorms.blogspot.com)


On 6/26/06, Robert Dober <robert.dober / gmail.com> wrote:
> On 6/26/06, Alexandru Popescu <the.mindstorm.mailinglist / gmail.com> 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-worlds-ruby.html
> >
> > However, I feel I have missed to explain correctly why eql? and ==
> > 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 in
> your mail
> http://www.ruby-doc.org/core/classes/Object.html#M001416
> if I interpret it correctly
>
> == 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 == b.object_id
> eql? is used for Hash entry comparison and is not redefined most of the time
>
> 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)
> >
> >
>
>
> --
> Deux choses sont infinies : l'univers et la bóŐise humaine ; en ce qui
> concerne l'univers, je n'en ai pas acquis la certitude absolue.
>
> - Albert Einstein
>
>