Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88105 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46268 invoked from network); 7 Sep 2015 18:43:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Sep 2015 18:43:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=dev@mabe.berlin; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dev@mabe.berlin; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mabe.berlin from 80.237.132.167 cause and error) X-PHP-List-Original-Sender: dev@mabe.berlin X-Host-Fingerprint: 80.237.132.167 wp160.webpack.hosteurope.de Received: from [80.237.132.167] ([80.237.132.167:42726] helo=wp160.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/02-34134-1CADDE55 for ; Mon, 07 Sep 2015 14:43:13 -0400 Received: from dslb-178-002-077-219.178.002.pools.vodafone-ip.de ([178.2.77.219] helo=[192.168.178.46]); authenticated by wp160.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) id 1ZZ1Nm-0004El-A6; Mon, 07 Sep 2015 20:43:10 +0200 To: internals@lists.php.net References: <20150827173432.GA71000@3006.local> <28.A5.59944.15C7CE55@pb1.pair.com> <20150907064310.GA12497@3006.local> Message-ID: <55EDDABD.6060407@mabe.berlin> Date: Mon, 7 Sep 2015 20:43:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20150907064310.GA12497@3006.local> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;dev@mabe.berlin;1441651393;f759b638; Subject: Re: [PHP-DEV] Re: [RFC] [Concept] Class Constant visibility modifiers in PHP 7.1+ From: dev@mabe.berlin (Marc Bennewitz) On 09/07/2015 08:43 AM, Sean DuBois wrote: > On Sun, Sep 06, 2015 at 06:47:56PM +0100, Andrea Faulds wrote: >> 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/ >> > Just one of those things that you you wish you had, but then end up > solving with other things (static properties) so we will see how long it > takes me to blunder through it :) > > Reeze Xia started an RFC, but didn't have time to finish it. We talked > over GitHub and I will be taking it over fully. > https://wiki.php.net/rfc/class_const_visibility > > I am just waiting on RFC Karma, after I get that I will start filling it in! I really like this feature but please make sure it doesn't break BC on usage of Reflection::getConstant(s). For example I'm using this for an implementation of constant based enumerations: (https://github.com/marc-mabe/php-enum/blob/master/src/Enum.php#L277) Marc