Issue #14148 has been updated by mame (Yusuke Endoh).


This change is intended.  See https://bugs.ruby-lang.org/issues/11547.  Matz said in that ticket:

> I am for this proposal, but also concern about code breakage. Let's try removing top-level constant look-up in 2.4dev and see how much code it breaks.

I think this change will not be cancelled just because you are surprised. ("Surprise" is NG word for persuasion in Ruby!)  This change might be cancelled if it breaks an existing code.  Did your actual code break?

----------------------------------------
Bug #14148: Longstanding behavior regarding correspondence of toplevel with Object is surprising
https://bugs.ruby-lang.org/issues/14148#change-68160

* Author: RickHull (Rick Hull)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
~~~ ruby
module Kernel
  X = 1
end

puts String::X

X = 2

puts String::X
~~~

~~~
$ ruby test.rb
1
Traceback (most recent call last):
test.rb:9:in `<main>': uninitialized constant String::X (NameError)
Did you mean?  X

$ ruby --version
ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
~~~



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>