AW: [PHP-DEV] Re: [RFC] [Concept] Class Constant visibility modifiers in PHP 7.1+

From: Date: Mon, 07 Sep 2015 07:29:18 +0000
Subject: AW: [PHP-DEV] Re: [RFC] [Concept] Class Constant visibility modifiers in PHP 7.1+
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-88079@lists.php.net to get a copy of this message
Hi Stas > -----Ursprüngliche Nachricht----- > Von: Joe Watkins [mailto:pthreads@pthreads.org] > Gesendet: Montag, 7. September 2015 09:15 > An: Stanislav Malyshev > Cc: PHP internals > Betreff: Re: [PHP-DEV] Re: [RFC] [Concept] Class Constant visibility modifiers in PHP 7.1+ > > > However, I have hard time seeing how that would apply to constants > > I don't see what their not changing has to do with their visibility. > > It's not hard to see a legitimate use case for private constants, a case that springs to > mind is where you use a public bitmask > for some configuration option but want to keep the shift or mask constants private, because > they might change, and you > don't want to leak that implementation detail. They are still constant at runtime, but > over the course of the life of the > codebase they can definitely change, and, they shouldn't be a static member or normal > variable. > > A common use case where I am using private constants in other programming languages is to give magic numbers a meaning without exposing them to the outside of a class. Seems legit to me. Cheers, Robert

« previous php.internals (#88079) next »