ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:100016] [Ruby master Feature#17171] Why is the visibility of constants not affected by `private`?
@ 2020-09-15 20:34 marcandre-ruby-core
  2020-09-15 21:04 ` [ruby-core:100017] " marcandre-ruby-core
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: marcandre-ruby-core @ 2020-09-15 20:34 UTC (permalink / raw)
  To: ruby-core

Issue #17171 has been reported by marcandre (Marc-Andre Lafortune).

----------------------------------------
Feature #17171: Why is the visibility of constants not affected by `private`?
https://bugs.ruby-lang.org/issues/17171

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* 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
```ruby

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/

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-10-26  7:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 20:34 [ruby-core:100016] [Ruby master Feature#17171] Why is the visibility of constants not affected by `private`? marcandre-ruby-core
2020-09-15 21:04 ` [ruby-core:100017] " marcandre-ruby-core
2020-09-15 23:18 ` [ruby-core:100018] " mame
2020-09-16 21:13 ` [ruby-core:100027] " eregontp
2020-09-17  7:36 ` [ruby-core:100029] " jean.boussier
2020-09-29 17:08 ` [ruby-core:100220] " shevegen
2020-10-16  3:55 ` [ruby-core:100414] " marcandre-ruby-core
2020-10-16  4:19 ` [ruby-core:100415] " merch-redmine
2020-10-16  5:26 ` [ruby-core:100416] " marcandre-ruby-core
2020-10-26  7:52 ` [ruby-core:100561] " matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).