Issue #2788 has been updated by shugo (Shugo Maeda). Priority changed from Low to Normal ko1 (Koichi Sasada) wrote: > nobu has patach. Does he have a Hebrew niqqud vowel sign? Aside from the joke, why not apply the patch, Nobu? ---------------------------------------- Bug #2788: nil.instance_eval pushes nil onto cref https://bugs.ruby-lang.org/issues/2788#change-28672 Author: shugo (Shugo Maeda) Status: Assigned Priority: Normal Assignee: nobu (Nobuyoshi Nakada) Category: core Target version: 2.0.0 ruby -v: ruby 1.9.2dev (2010-02-18 trunk 26704) [i686-linux] =begin A singleton class definition of nil pushes NilClass onto cref. It is reasonable because NilClass has nil as the only instance. However, nil.instance_eval pushes nil onto cref, which means that method definitions are not permitted in that context. defiant:ruby$ ruby-trunk -ve 'class <<nil; def foo; puts "foo" end; end; nil.foo' ruby 1.9.2dev (2010-02-18 trunk 26704) [i686-linux] foo defiant:ruby$ ruby-trunk -ve 'nil.instance_eval {|i| def foo; puts "foo" end }; nil.foo' ruby 1.9.2dev (2010-02-18 trunk 26704) [i686-linux] -e:1:in `block in <main>': no class/module to add method (TypeError) from -e:1:in `instance_eval' from -e:1:in `<main>' The behavior is the same in Ruby 1.8.7. Is it intended or a bug? =end
on 2012-08-06 10:15
on 2012-08-06 10:43
Hello,
In message "[ruby-core:47015] [ruby-trunk - Bug #2788] nil.instance_eval
pushes nil onto cref"
on Aug.06,2012 17:15:16, <redmine@ruby-lang.org> wrote:
> Aside from the joke, why not apply the patch, Nobu?
Wait until he drives his time machine.
Regards,
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.