Issue #11547 has been updated by Sebastian Cohnen.


With 2.4 released and I wasn't able to find anything related to this issue in https://github.com/ruby/ruby/blob/v2_4_0/NEWS I guess it did not make it into 2.4.

I was wondering if there are any plans regarding working on this. In almost all projects I encounter this issue and it would be great if this could improve.

----------------------------------------
Feature #11547: remove top-level constant lookup
https://bugs.ruby-lang.org/issues/11547#change-62330

* Author: Corin Langosch
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
If ruby cannot find a class in the specified scope it uses the top-level constant of the same name if it exists and emits a warning:

~~~
irb(main):006:0> class Auth; end
=> nil
irb(main):007:0> class Twitter; end
=> nil
irb(main):008:0> Twitter::Auth
(irb):8: warning: toplevel constant Auth referenced by Twitter::Auth
=> Auth
~~~

In some cases this is not playing nicely with rails autoloading as can be seen here: https://github.com/rails/rails/issues/6931. Many more issues like this exist.

Imo I don't see any reason why this fallback makes any sense. So I'd like to suggest to remove it completely or at least add an option to disable it.





-- 
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>