From: Todd Benson Date: 2007-07-25T03:27:01+09:00 Subject: Re: object equivalence On 7/24/07, Andrew Hume wrote: > i have two objects, a and b, both of the same class. > i believe they have the same contents, but > a.eql?(b) returns false > > if i write a method xxx that returns as a string the value of every > field > (much as to_s does), then a.xxx.hash == b.xxx.hash. > i believe this latter shows a and b are equivalent; o why > doesn't eql? agree? eql? is just a method and therefore depends on the implementing object. By default, eql? returns true only if the objects being compared are the _same_ object. And then, each class typically overrides eql? to do as the developer sees fit. Todd