Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101128 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72860 invoked from network); 12 Nov 2017 09:50:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Nov 2017 09:50:29 -0000 Authentication-Results: pb1.pair.com header.from=alice@librelamp.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=alice@librelamp.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain librelamp.com designates 45.79.96.192 as permitted sender) X-PHP-List-Original-Sender: alice@librelamp.com X-Host-Fingerprint: 45.79.96.192 librelamp.com Received: from [45.79.96.192] ([45.79.96.192:56110] helo=librelamp.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/B9-15386-369180A5 for ; Sun, 12 Nov 2017 04:50:28 -0500 Received: from localhost.localdomain (unknown [IPv6:2600:1010:b12b:3b97:d4fa:fe82:4b9e:d42]) by librelamp.com (Postfix) with ESMTPSA id 83C6783D for ; Sun, 12 Nov 2017 09:50:24 +0000 (UTC) To: internals@lists.php.net References: <93a05192-ed34-2164-50f9-2799899b32d1@fleshgrinder.com> <4ee3d414-92e1-75c7-402f-16a37ed3016b@fleshgrinder.com> <3f093ce2-e00e-f210-6e35-de31eb2f4b07@gmail.com> <0061a0c9-328c-75cb-cf6f-8e444e9ea3c0@fleshgrinder.com> <2f555141-96e0-3bab-c191-1216747644a5@fleshgrinder.com> <549c4634-ac38-41d3-ab43-f816a9f2b1e5@fleshgrinder.com> <31.39.15386.196180A5@pb1.pair.com> Message-ID: <8a8515ec-31a4-5234-d83e-beb9f0144c07@librelamp.com> Date: Sun, 12 Nov 2017 01:50:23 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <31.39.15386.196180A5@pb1.pair.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Constants and Access Modifiers From: alice@librelamp.com (Alice Wonder) On 11/12/2017 01:38 AM, Tony Marston wrote: > wrote in message > news:549c4634-ac38-41d3-ab43-f816a9f2b1e5@fleshgrinder.com... >> >> On 11/12/2017 12:44 AM, Stanislav Malyshev wrote: >>> Hi! >>> >>>> Yes, Dart has a different understanding of const, which is exactly >>>> why I >>>> posted it for you guys. In the hope that it helps to get more different >>>> views on the topic. Currently you are too concentrated on how it is >>>> implemented in PHP at this time, and argue that it is impossible to >>>> diverge from that path. Which is simply not true, we only have to >>>> ensure >>>> backwards compatibility. >>> >>> I am not arguing it's impossible, I am arguing it is not a good idea. We >>> have the concept of constants in this language, and bolting on it a >>> completely different concept from different language, which by >>> coincidence was named with the same term, would only be a source of >>> confusion. If we wanted immutable objects in language - which I am not >>> convinced at all we do, but assuming for a minute we did - there's no >>> reason to conflate them with constants as we have them now. These are >>> different things. >>> >> >> I did not mean to say that we have to have everything exactly as Dart >> has it. I just wanted to show, that the meaning of const as we have is >> not universally the same. >> >> Abstract constants would also only be truly useful if we could define >> the type as well on them. Which is currently not possible. Also, I am >> not saying that the requested feature MUST be done with const. However, >> it should behave like one, which is impossible with methods. > > Just because some languages use a corrupt definition of "constant" is no > reason for PHP to do the same. A constant has a value which, once > defined, cannot be changed. It is not logical to define a constant name > in one place and its value in another. > Plus plus on this. A constant does not change. If it changes it is a variable. I do not know anything about Dart but if they are changing the meaning of well-defined terms like constant, I worry that there will be programs with security holes simply because some developers will not understand what they mean by the terms they define.