Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88065 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19396 invoked from network); 6 Sep 2015 17:48:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Sep 2015 17:48:03 -0000 X-Host-Fingerprint: 2.122.81.212 unknown Received: from [2.122.81.212] ([2.122.81.212:25237] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/A5-59944-15C7CE55 for ; Sun, 06 Sep 2015 13:48:02 -0400 Message-ID: <28.A5.59944.15C7CE55@pb1.pair.com> To: internals@lists.php.net References: <20150827173432.GA71000@3006.local> Date: Sun, 6 Sep 2015 18:47:56 +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: <20150827173432.GA71000@3006.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 2.122.81.212 Subject: Re: [RFC] [Concept] Class Constant visibility modifiers in PHP 7.1+ From: ajf@ajf.me (Andrea Faulds) Hi Sean, Sean DuBois wrote: > > I am starting this discussion to get peoples opinion on the overall feature, and find someone > who would be interested in watching over my progress and making sure I > do the right things to hopefully get this merged. > > The PHP bug tracker contains a few simple entries for a adding visibility modifiers to class constants. > https://bugs.php.net/bug.php?id=27022 > > I would be the one implementing this, and have a basic working version already (that > takes shortcuts like reusing property_info) but it works! > https://github.com/Sean-Der/php-src/compare/master...bug-69980-class-constants#diff-6231c13c8582758f41a5e2a015e3b5c5R1 > There are cases where runtime/compile time checks pass/fail incorrectly, > but working on that now. > > This change would involve breaking the API, but wouldn't involved any > language breaking changes. All current const declarations would just > default to public and keep the same behavior. Funny you should propose this now, I was wanting this feature just the other day. This would be a useful addition, and clean up a strange inconsistency: why can methods and properties have visibility modifiers, but not constants? I'd love to see this in PHP. Are you going to write an RFC? Thanks! -- Andrea Faulds http://ajf.me/