rubinius/rubinius — pull request #1566 by ileitch (2012-02-19 20:13:23+00:00)
Title: Feedback required: Fix Method#eql? specs for 1.9

I'd like some feedback on these commits before I push them. MRI 1.9 has added some rather complex behaviour for method equality.

4d5ca7e1 - Method#eql? returns true for methods defined using the same block/proc.

* I implemented the method in common/block_environment.rb has it uses the attr_readers already defined there. I wasn't sure that moving the attr_readers into bootstrap/block_environment.rb was acceptable.

* See the comment in #==, could this be cleaned up somehow?

6ebdbe83 - Method#eql? returns true if a method was defined using the other one.

* When a method is defined using another, a DelegatedMethod is created. The DelegatedMethod's executable is an UnboundMethod. I simply convert the CompiledMethod to an UnboundMethod and compare it against the DelegatedMethod's UnboundMethod. Is this an acceptable approach?

* Note the conditions in `self_or_other_is_delegated?`. The presence of a DelegatedMethod must be mutually exclusive, otherwise the next commit will fail when both self and other are DelegatedMethods and have the same executable (though their names are different).

a14d31ce - Method#eql? returns true for the same method missing

* Please check the use of DelegatedMethod in combination with Method, I'm not 100% sure this is the correct approach.