Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88103 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41838 invoked from network); 7 Sep 2015 18:09:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Sep 2015 18:09:13 -0000 X-Host-Fingerprint: 94.7.93.128 unknown Received: from [94.7.93.128] ([94.7.93.128:25396] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C0/41-34134-5C2DDE55 for ; Mon, 07 Sep 2015 14:09:13 -0400 Message-ID: To: internals@lists.php.net References: <20150827173432.GA71000@3006.local> <28.A5.59944.15C7CE55@pb1.pair.com> <55ED368C.5010209@gmail.com> Date: Mon, 7 Sep 2015 19:09:02 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0 SeaMonkey/2.35 MIME-Version: 1.0 In-Reply-To: <55ED368C.5010209@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 94.7.93.128 Subject: Re: [PHP-DEV] Re: [RFC] [Concept] Class Constant visibility modifiersin PHP 7.1+ From: ajf@ajf.me (Andrea Faulds) Hi Stas, Stanislav Malyshev wrote: > > Private and protected methods and properties are private for a reason - > they may be radically changed or gone when the code is changing, and > thus external code should not rely on them, and the way to ensure it is > to deny that code access to them. However, I have hard time seeing how > that would apply to constants - they shouldn't really change, Why not? A constant's value doesn't change at runtime, but nothing stops you changing the value in a new version. A real-world example for you: phpng changed the values of the IS_* constants in the Zend Engine. > and if > they do, they either shouldn't be constant, or something in your world > changed fundamentally (i.e. scientists discovered that PI actually > equals to 4). Constants in code aren't necessarily natural constants. I wonder if you find in your code constant that you need > to hide because you foresee it changing - should it really be a constant > at all? If I have a value specified in the source code which will not change at runtime, and which I don't want to expose as part of my public API... what exactly do you propose it should be? I don't see why a constant isn't fitting. Thanks. -- Andrea Faulds http://ajf.me/