From: "mame (Yusuke Endoh)" Date: 2012-05-17T00:10:56+09:00 Subject: [ruby-core:45084] [ruby-trunk - Bug #6408][Assigned] DelegateClass#eql? and <=> don't work as expected Issue #6408 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to tenderlovemaking (Aaron Patterson) Target version set to 3.0 Hello, Aaron What do you think about Jeremy's opinion? I'm just wondering but why do you want to delegate #eql? ? I guess that is because you are inserting Delegate objects to a Hash. Such a code is still dangerous even if the patch is applied: require "delegate" class Foo; end class Bar < DelegateClass(Foo); end foo = Foo.new bar = Bar.new(foo) p foo.eql?(foo) #=> true p bar.eql?(foo) #=> true p bar.eql?(bar) #=> false (this returns true with your patch) p foo.eql?(bar) #=> false (this is NOT fixed) h = { bar => 42 } p h[foo] #=> nil, not 42 I think it is difficult to "fix." The same holds for #<=>. You should not sort an Array that includes Delegate objects. -- Yusuke Endoh ---------------------------------------- Bug #6408: DelegateClass#eql? and <=> don't work as expected https://bugs.ruby-lang.org/issues/6408#change-26658 Author: tenderlovemaking (Aaron Patterson) Status: Assigned Priority: Normal Assignee: tenderlovemaking (Aaron Patterson) Category: Target version: 3.0 ruby -v: ruby 2.0.0dev (2012-05-06 trunk 35548) [x86_64-darwin11.3.0] It seems these two methods aren't delegating to the delegate object when compared against itself. I've attached a patch with tests and a fix. It seems nobody is the maintainer for delegate.rb (according to the wiki), so if nobody objects, I will apply this patch. -- http://bugs.ruby-lang.org/