Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88910 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57915 invoked from network); 21 Oct 2015 17:32:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Oct 2015 17:32:05 -0000 Authentication-Results: pb1.pair.com header.from=aaron@icicle.io; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=aaron@icicle.io; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain icicle.io designates 199.38.81.6 as permitted sender) X-PHP-List-Original-Sender: aaron@icicle.io X-Host-Fingerprint: 199.38.81.6 mercury.negativeion.net Received: from [199.38.81.6] ([199.38.81.6:50533] helo=mercury.negativeion.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/60-55035-21CC7265 for ; Wed, 21 Oct 2015 13:32:03 -0400 Received: from localhost (localhost [127.0.0.1]) by mercury.negativeion.net (Postfix) with ESMTP id 610DD2EF4BD9; Wed, 21 Oct 2015 13:32:00 -0400 (EDT) X-Virus-Scanned: amavisd-new at negativeion.net Received: from mercury.negativeion.net ([127.0.0.1]) by localhost (mercury.negativeion.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xc6VScQWWnmY; Wed, 21 Oct 2015 13:31:59 -0400 (EDT) Received: from macpro.local (unknown [173.225.158.77]) by mercury.negativeion.net (Postfix) with ESMTPSA id 7F4D52EF4BCA; Wed, 21 Oct 2015 13:31:59 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) In-Reply-To: <20151021161740.GA23933@3006.local> Date: Wed, 21 Oct 2015 12:31:58 -0500 Cc: danack@basereality.com, PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <20151020173602.GA92318@3006.local> <20151021161740.GA23933@3006.local> To: Sean DuBois X-Mailer: Apple Mail (2.2098) Subject: Re: [PHP-DEV] [RFC] [VOTE] Class Constant Visibility From: aaron@icicle.io (Aaron Piotrowski) Hi Sean, > On Oct 21, 2015, at 11:17 AM, Sean DuBois wrote: >=20 > On Wed, Oct 21, 2015 at 03:54:48PM +0000, Dan Ackroyd wrote: >> Hi Sean, internals, >>=20 >> While I support this RFC, it seems that the actual implementation is >> still under discussion. >>=20 >> In particular, whether the RFC is going to allow protected constants >> in an interface is not clear. >>=20 >> In the text of the RFC, on one line it says: "This RFC propose PHP >> support class constant visibility that mirror the behaviour of method >> and property visibility." This would imply that protected constants >> are not allowed, as protected methods are not allowed in interfaces. >>=20 >> Just below it says: "//Interfaces only support protected/public = const, >> and a compile time error will be throw for privates" Which says >> clearly that protected constants _would_ be allowed. >>=20 >> Please can you update the text of the RFC? >>=20 >> Unfortunately, that may need a restart of the voting :-\ However that >> should just be a formality as it seems to be a popular RFC. >>=20 >> cheers >> Dan >>=20 >> -- > Hi! >=20 > That is an unfortunate mistake on my part. The *proper* way to adjust > visibility of a trait from a class constant is the following. >=20 > trait myTrait { > public const FOO =3D 'bar' > } >=20 > class myClass { > use myTrait { FOO as protected; } > } >=20 > class myClass { > use myTrait { FOO as private; } > } >=20 > We should not allow anything besides public in trait, this mirrors the = design of methods. >=20 > If this is right (mind just sending an ACK to make sure I got it right = this time) I > will update the RFC. Who decides if/when we should restart voting? >=20 > thanks >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20 I think you may have misunderstood. Traits should be able to have = protected and private constants. The issue that Dan pointed out is with = an interface having a protected constant in the example code, = contradicting what was written prior in the RFC about mirroring the = current behavior of method and property visibility. Interfaces should only be allowed to have public constants. Protected = constants would infer that the interface knows something about = implementation, which doesn=E2=80=99t make sense for an interface. I = think the RFC should be updated to remove this ambiguity. I=E2=80=99m not sure if this would require the vote to be restarted, as = I doubt anyone who voted yes would now vote no with this change. Regards, Aaron Piotrowski