From: shugo@... Date: 2015-10-28T06:32:10+00:00 Subject: [ruby-core:71240] [Ruby trunk - Feature #11547] [Feedback] remove top-level constant lookup Issue #11547 has been updated by Shugo Maeda. Status changed from Open to Feedback Corin Langosch wrote: > 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: (snip) > 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. How should the following code behave? ``` class Foo X = 1 end module Bar Y = 2 end class Baz < Foo include Bar end p Baz::X p Baz::Y ``` ---------------------------------------- Feature #11547: remove top-level constant lookup https://bugs.ruby-lang.org/issues/11547#change-54617 * Author: Corin Langosch * Status: Feedback * Priority: Normal * Assignee: ---------------------------------------- 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/