From: "ko1 (Koichi Sasada)" Date: 2012-06-26T04:15:52+09:00 Subject: [ruby-core:45841] [ruby-trunk - Bug #2788] nil.instance_eval pushes nil onto cref Issue #2788 has been updated by ko1 (Koichi Sasada). Assignee changed from ko1 (Koichi Sasada) to matz (Yukihiro Matsumoto) I'm so sorry to miss your ticket for long time. Always I get confusing about instance eval with special variables (nil, false, etc). Matz (shugo-san is specialist?), could you determine the specification? ---------------------------------------- Bug #2788: nil.instance_eval pushes nil onto cref https://bugs.ruby-lang.org/issues/2788#change-27422 Author: shugo (Shugo Maeda) Status: Assigned Priority: Low Assignee: matz (Yukihiro Matsumoto) 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 <': no class/module to add method (TypeError) from -e:1:in `instance_eval' from -e:1:in `
' The behavior is the same in Ruby 1.8.7. Is it intended or a bug? =end -- http://bugs.ruby-lang.org/