From: Jeremy Evans Date: 2012-05-07T09:44:35+09:00 Subject: [ruby-core:44917] Re: [ruby-trunk - Bug #6408] DelegateClass#eql? and <=> don't work as expected On 05/07 07:15, marcandre (Marc-Andre Lafortune) wrote: > > Hi, > > In your patch, for both `if obj.equal? self`, shouldn't it be `if obj.is_a? Delegator`? > > For many classes that define their comparison operators, this might not be sufficient if you want comparison operators to work well, as they typically will first check on the class of the object to compare with. > > Defining `is_a?` to return true for either Delegator or the class delegated to might be more helpful. When I use DelegateClass, it's often because I want a proxy object that mostly acts like the given class, but is specifically not treated as the given class (in terms of the is_a? and === methods). Changing this behavior would likely break existing code. So if this to be considered, it should probably not change until 3.0 (unless matz makes an exception for this case). Jeremy