Issue #2402 has been updated by shugo (Shugo Maeda). Status changed from Closed to Open Reopened the issue because r36640 is reverted by r36795. ---------------------------------------- Bug #2402: super in instance_eval https://bugs.ruby-lang.org/issues/2402#change-28996 Author: shugo (Shugo Maeda) Status: Open Priority: Normal Assignee: ko1 (Koichi Sasada) Category: Target version: 2.0.0 ruby -v: ruby 1.9.2dev (2009-11-24 trunk 25909) [i686-linux] =begin instance_evalのブロック内でsuperを呼ぶと、instance_evalで変更された selfに対してsuperの呼び出しを行ってしまうようです。 defiant:build$ cat t.rb class Foo def foo p self end end class Bar < Foo def foo x = Object.new x.instance_eval do super end end end Bar.new.foo defiant:build$ ./ruby-trunk.1124 -v t.rb ruby 1.9.2dev (2009-11-24 trunk 25909) [i686-linux] #<Object:0x8590f6c> Foo#fooが呼ばれるのにselfがObjectという、ちょっとおかしなことになっています。 ちょっと自信がありませんが、一応パッチを添付します。 =end
on 2012-08-27 13:59
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.