From: okkez000@... Date: 2017-02-10T02:31:05+00:00 Subject: [ruby-dev:49979] [Ruby trunk Bug#13204] Search order of constant is different Issue #13204 has been reported by okkez _. ---------------------------------------- Bug #13204: Search order of constant is different https://bugs.ruby-lang.org/issues/13204 * Author: okkez _ * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- ```ruby class CleanRoom < BasicObject def call instance_eval(<<-CODE) $stdout.puts ::ENV.size CODE end def call2 instance_eval(<<-CODE) $stdout.puts ENV.size CODE end def call3 instance_eval { $stdout.puts ::ENV.size } end end class CleanRoom2 def call instance_eval(<<-CODE) $stdout.puts ENV.size CODE end end CleanRoom.new.call # => 80 (in my environment) CleanRoom2.new.call # => 80 CleanRoom.new.call3 # => 80 CleanRoom.new.call2 # => t.rb:14:in `instance_eval': uninitialized constant #>::ENV (NameError) ``` `CleanRoom` instance cannot refer constants defined in top level. Is this intentional? -- https://bugs.ruby-lang.org/