Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100975 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14940 invoked from network); 28 Oct 2017 07:57:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Oct 2017 07:57:03 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.89 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.89 mx108.easyname.com Received: from [77.244.243.89] ([77.244.243.89:59970] helo=mx108.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/D2-28573-D4834F95 for ; Sat, 28 Oct 2017 03:57:02 -0400 Received: from cable-81-173-135-10.netcologne.de ([81.173.135.10] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1e8LzF-0006xw-BY; Sat, 28 Oct 2017 07:56:58 +0000 Reply-To: internals@lists.php.net To: Nikita Popov , PHP internals References: <93a05192-ed34-2164-50f9-2799899b32d1@fleshgrinder.com> Message-ID: <4ee3d414-92e1-75c7-402f-16a37ed3016b@fleshgrinder.com> Date: Sat, 28 Oct 2017 09:56:44 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2KjTxAkCB1SnE0FCdpmgH8StxKXs1fV2S" X-DNSBL-BARRACUDACENTRAL: YES X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] Constants and Access Modifiers From: php@fleshgrinder.com (Fleshgrinder) --2KjTxAkCB1SnE0FCdpmgH8StxKXs1fV2S Content-Type: multipart/mixed; boundary="DnGB6uVdtim6Ua1jjLpu9rLTK6tR1R6ES"; protected-headers="v1" From: Fleshgrinder Reply-To: internals@lists.php.net To: Nikita Popov , PHP internals Message-ID: <4ee3d414-92e1-75c7-402f-16a37ed3016b@fleshgrinder.com> Subject: Re: [PHP-DEV] Constants and Access Modifiers References: <93a05192-ed34-2164-50f9-2799899b32d1@fleshgrinder.com> In-Reply-To: --DnGB6uVdtim6Ua1jjLpu9rLTK6tR1R6ES Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 10/27/2017 11:15 PM, Nikita Popov wrote: > PHP does not permit self-referencing constants. >=20 > However, this is only checked when the constant is first accessed. In y= our > first example the constant is never accessed, so no error is thrown. Th= is > has nothing to do with subclasses defining the value -- you're using la= te > static binding, so you're accessing the constant of the child class > directly. >=20 > PHP cannot detect self-referencing constants during compilation, becaus= e > they may be formed through non-trivial cycles involving multiple consta= nts, > across multiple files. >=20 > Nikita >=20 My wording was maybe a bit wrong here, and I was biased by the fact that I would like to see abstract constants. The fact that not everything can be detected at compile time, but only later at runtime is normal in a highly dynamic language like PHP. Self-referencing constants make no sense, hence, it is fine. It would of course be better if the compiler could detect that earlier, but we are not doing AOT so imho that is fine. The behavior here is also consistent among versions as well as HHVM, all good. What do you think about the other ideas I raised? --=20 Richard "Fleshgrinder" Fussenegger --DnGB6uVdtim6Ua1jjLpu9rLTK6tR1R6ES-- --2KjTxAkCB1SnE0FCdpmgH8StxKXs1fV2S Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZ9DhFAAoJEOKkKcqFPVVryLQP/jzkSfJo/bJ2a6YfXwdJFXcn j54tWg9dMBVzGa/3fca7Mui9JkfiPkfQ0lWdodi8tl40BEWWi3wGjgeU6E7QTMIJ eiLdcwfbmxukG+CTaQVCLyMw61rdNulRpT2DvmYFHaICXktyqQFi7kJbWOMobKyo a3CXVZWs5PCpUx15dkLOodQDM2PrUkWl0zmUzbfI2V1SW1nEx0oOa9FJGT6rll1o CKyi8KnMTdB1Bu8krCUpOi4LfCx5vQQs/n25+uIS9uxsp7e0QSyF9QXa58S5X4iH M0FjJf8bmOvcdzLrHl202yLidqwm1LXLPNM13t4RU1Q6Gg5Ltq7epa0esvcsVDNL aoZJrvuT+6NBRo9th1lTN3mTRebU/ujEqaMgK++tudTS3IZRUQpeEaJIfz5aeb9T JGr4qli5vbipjin4DWJ0gi2wdDo9yikAzRCb+kUdkerRheldU3PR9ZCByhkAbJ4b 9d5MaCpMOWqwe+hrMBzZG62Fz/Ayg/8Vkv4uKjcQ24W4s1eWFWrrUCeFhDTet1UQ JNiphcF6w+4CeYdL0VZRukWv6TGsEu1747E+bnKXnRCIo8ncUHMnPe32psds9B7J tQHEoHar0Pg28+hvM4B4rpzn4ofWmsES1QgpFBBerDgOdEJm7w1E7M5fch1iQOyh fu8ZukEDFA9/uD1eXdko =FxEk -----END PGP SIGNATURE----- --2KjTxAkCB1SnE0FCdpmgH8StxKXs1fV2S--