Issue #7806 has been reported by Hanmac (Hans Mackowiak). ---------------------------------------- Bug #7806: inconsistency between Method#inspect and Method#name https://bugs.ruby-lang.org/issues/7806 Author: Hanmac (Hans Mackowiak) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] it seems that Method#inspect does some magic with alias methods code: (({class A def xyz end alias ver xyz end p A.instance_method(:ver) #<UnboundMethod: A#xyz> p A.instance_method(:ver).name #:ver a=A.new p a.method(:ver) #<Method: A#xyz> p a.method(:ver).name #:ver })) shouldn't the #inspect method use the #name one? maybe #alias? and #alias_target and maybe inspect return something like #<Method: A#ver(xyz)> so it can be seen that the method is an alias? PS: sorry i cant get the code tag working currectly
on 2013-02-08 23:44
on 2013-02-12 13:49
Issue #7806 has been updated by nobu (Nobuyoshi Nakada). Description updated ---------------------------------------- Bug #7806: inconsistency between Method#inspect and Method#name https://bugs.ruby-lang.org/issues/7806#change-36167 Author: Hanmac (Hans Mackowiak) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] =begin it seems that Method#inspect does some magic with alias methods code: class A def xyz end alias ver xyz end p A.instance_method(:ver) #<UnboundMethod: A#xyz> p A.instance_method(:ver).name #:ver a=A.new p a.method(:ver) #<Method: A#xyz> p a.method(:ver).name #:ver shouldn't the #(({inspect})) method use the #(({name})) one? maybe #(({alias?})) and #(({alias_target})) and maybe (({inspect})) return something like ((%#<Method: A#ver(xyz)>%)) so it can be seen that the method is an alias? PS: sorry i cant get the code tag working currectly
on 2013-02-14 02:39
Issue #7806 has been updated by ko1 (Koichi Sasada). Status changed from Closed to Open Assignee set to nobu (Nobuyoshi Nakada) Target version set to next minor Nobu, you add new method Method#original_name on r39223. Could you explain about it, why and what? I make the target version of this ticket `next minor'. If it should be applied to 2.0.0, please change it and make backport ticket. ---------------------------------------- Bug #7806: inconsistency between Method#inspect and Method#name https://bugs.ruby-lang.org/issues/7806#change-36268 Author: Hanmac (Hans Mackowiak) Status: Open Priority: Normal Assignee: nobu (Nobuyoshi Nakada) Category: Target version: next minor ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] =begin it seems that Method#inspect does some magic with alias methods code: class A def xyz end alias ver xyz end p A.instance_method(:ver) #<UnboundMethod: A#xyz> p A.instance_method(:ver).name #:ver a=A.new p a.method(:ver) #<Method: A#xyz> p a.method(:ver).name #:ver shouldn't the #(({inspect})) method use the #(({name})) one? maybe #(({alias?})) and #(({alias_target})) and maybe (({inspect})) return something like ((%#<Method: A#ver(xyz)>%)) so it can be seen that the method is an alias? PS: sorry i cant get the code tag working currectly
on 2013-02-14 03:31
(13/02/14 10:38), ko1 (Koichi Sasada) wrote: > Nobu, you add new method Method#original_name on r39223. > > Could you explain about it, why and what? To obtain original method name, when the name is an alias. > I make the target version of this ticket `next minor'. > If it should be applied to 2.0.0, please change it and make backport ticket. No, I don't think it needs to be backported.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.