Project

General

Profile

Feature #7274

Updated by nobu (Nobuyoshi Nakada) about 11 years ago

=begin 
 as a corollary, (({UnboundMethod}))s UnboundMethods referencing the same method name on the same owner, should be equal 

 currently (({UnboundMethod}))s UnboundMethods binding is determined by the class via which they were retrieved, not the owner 

  
 ____________________________________ 
 class Base; def foo; end end 
  
 class Sub < Base; end 

  

 base_foo = Base.instance_method :foo 
  
 sub_foo = Sub.instance_method :foo 
  
 sub_foo.bind(Base.new).call 
 __________________________________ 

 (({sub_foo.owner})) sub_foo.owner is (({Base})) Base so there does not seem to be any reason why it's not safe for it to bind to an instance of (({Base})). Base. 

 and there does not seem to be any reason for (({sub_foo})) sub_foo and (({base_foo})) base_foo to be unequal, they both refer to the same method, (({foo})) foo on (({Base})). 
 =end 
 Base.

Back