From: matz@... Date: 2020-10-26T07:52:20+00:00 Subject: [ruby-core:100561] [Ruby master Feature#17171] Why is the visibility of constants not affected by `private`? Issue #17171 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Rejected This looks very interesting, but it would introduce quite big incompatibility. I don't want to break existing code. Matz. ---------------------------------------- Feature #17171: Why is the visibility of constants not affected by `private`? https://bugs.ruby-lang.org/issues/17171#change-88191 * Author: marcandre (Marc-Andre Lafortune) * Status: Rejected * Priority: Normal ---------------------------------------- ```ruby class Foo def call_me # ... end private SOME_DATA = %i[...].freeze # is public, why not private? def calc_stuff # is private, ok. # ... end end ``` It's probably a naive question, but why shouldn't `SOME_DATA`'s visibility be private? When writing gems, more often than not the constants that I write are not meant for public consumption. I find it redundant (and tiresome) to explicitly write `private_constant :SOME_DATA`. -- https://bugs.ruby-lang.org/ Unsubscribe: