Hi Stas

> -----Ursprüngliche Nachricht-----
> Von: Joe Watkins [mailto:pthre...@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


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to