From: ES Date: 2005-05-11T10:41:56+09:00 Subject: Re: Getting rid of Object#equal?()? Gavin Sinclair wrote: > On Friday, May 6, 2005, 10:04:37 AM, Yukihiro wrote: > > >>Hi, > > >>In message "Re: Getting rid of Object#equal?()?" >> on Thu, 5 May 2005 23:57:30 +0900, Florian Gro� writes: > > >>|I think that we currently have too many equality methods with similar names: >>| >>|==: same meaning >>|eql?: same value (for hashes) >>|equal?: identical object >>| >>|I think that equal?() is rarely used and that removing it completely >>|would make sense -- after all a.id == b.id is not much longer than >>|a.equal?(b). > > >>I'm not motivated too much to remove "equal?". I assume Ruby users >>smart enough to distinguish above three without any confusion once >>they are told. Are there any reason to remove? > > > I'm not so smart; I've had to consult the documentation several times > to distinguish them. Probably the simplest solution (psuedu-code): > > class Object > remove_method :equal? > alias_method :same? :eql? > end > > I'd rather use the methods #same? and #== and forget about everything > else. I do not think any methods should be removed if it can be avoided. That way there would be no breakage. Aliasing would work fine: alias_method :eql :equals? # Same value alias_method :equal :same? # Same object alias_method :equal :is? > Gavin E -- template void quack(duck& d) { d.quack(); }