Bug #4058

__method__ does not return correct method name for aliased methods

Added by john mair over 4 years ago. Updated almost 4 years ago.

[ruby-core:33189]
Status:Closed
Priority:Normal
Assignee:-
ruby -v:ruby 1.9.2p0 (2010-08-18) [i386-mingw32] Backport:

Description

=begin
class Test
def my_method
method
end

alias_method :my_alias, :my_method
end

Hello.new.my_method #=> :my_method
Hello.new.my_alias #=> :my_method

I think that Hello.new.my_alias should instead return :my_alias
=end

History

#1 Updated by Run Paint Run Run over 4 years ago

=begin
This is intended. Originally, callee and method were equivalent, except in aliased methods where the former returned the aliased name, and the latter returned the non-aliased name. Then, later, matz changed callee_ to be identical to __method.
=end

#2 Updated by Run Paint Run Run over 4 years ago

=begin

This is intended. Originally, callee and method were equivalent, except in aliased methods where the former returned the
aliased name, and the latter returned the non-aliased name. Then, later, matz changed callee_ to be identical to __method.

Proof I'm not making this up: http://redmine.ruby-lang.org/repositories/revision/ruby-19?rev=14448 ;-). This can be closed.
=end

#3 Updated by Yui NARUSE about 4 years ago

  • Status changed from Open to Closed

#4 Updated by Charlton Wang almost 4 years ago

Is there any hope of getting callee functionality back at some point? I tried to write a ruby extension that provided a function to call what used to be called by callee but that doesn't appear to work. Has the VM changed to the point where we'll never get this functionality back?

Also available in: Atom PDF