Issue #16752 has been updated by shevegen (Robert A. Heiler).


I somewhat agree with sawa here.

This may still leave the issue over whether one may prefer a single line/method
call, but I believe this may largely depend on the use case more (if there is
one). I can understand it to some extent if a ruby user may wish to avoid using
the ";", I sometimes want to avoid ";" too. In these cases, I typically do as
sawa pointed out, and just use a new line. :)

But I don't have any really strong preferences here either way, also because
I do not think I have actually used private_constant so far (did not seem
to be necessary for me). I did, however had, have lots of use cases in the past
for const_set() (or whatever the name was for setting a constant for a 
particular "namespace" ... I always mix it up with set_const() which I think
does not exist :P ), and also removing this. There are quite many use
cases for the latter, more than for private*, I think. But your mileage
may vary.



----------------------------------------
Feature #16752: :private param for const_set
https://bugs.ruby-lang.org/issues/16752#change-84889

* Author: bughit (bug hit)
* Status: Open
* Priority: Normal
----------------------------------------
Defining a private constant should not require two method calls.

You want to encourage private declarations because they communicate intent better and are easier to refactor, two statements discourage it.

Ideally there should be compact syntax for direct private declarations, but that's probably a difficult change.

But `const_set :FOO, 1, private: true` or `const_set :FOO, 1, :private` should be trivial



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