Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101131 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92783 invoked from network); 12 Nov 2017 19:00:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Nov 2017 19:00:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=lists@rhsoft.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=lists@rhsoft.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain rhsoft.net designates 91.118.73.15 as permitted sender) X-PHP-List-Original-Sender: lists@rhsoft.net X-Host-Fingerprint: 91.118.73.15 mail.thelounge.net Received: from [91.118.73.15] ([91.118.73.15:13391] helo=mail.thelounge.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B3/5B-15386-86A980A5 for ; Sun, 12 Nov 2017 14:00:58 -0500 Received: from srv-rhsoft.rhsoft.net (Authenticated sender: h.reindl@thelounge.net) by mail.thelounge.net (THELOUNGE MTA) with ESMTPSA id 3yZjln28TjzXKg for ; Sun, 12 Nov 2017 20:00:53 +0100 (CET) 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> <3b592a4b-c56d-fd16-f977-7c9898fabf57@gmail.com> Message-ID: Date: Sun, 12 Nov 2017 20:00:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-CH Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Constants and Access Modifiers From: lists@rhsoft.net ("lists@rhsoft.net") Am 12.11.2017 um 19:25 schrieb Rowan Collins: > On 12/11/2017 09:49, Fleshgrinder wrote: >> There is one thing that differs for the const >> and the field: a const value must be known at compile time, whereas a >> field value does not. An important difference! >> >>      class A { abstract public const FOO: int; } >>      class A { abstract public function foo(): int; } >> >> These also look basically the same. The return value of the method, >> however, may also be determined at runtime (just like with fields) and >> on top of that might change with every invocation. > > What I'm not really clear on is *why* the value being known at > compile-time is important to you. Is there some architectural decision > you would make differently based on this guarantee? Are you expecting > the language itself to have some optimisation or different behaviour > based on that guarantee? compile time at least leaves space for optimization and looking what opcache only since PHP7.0 got and looking forward to a JIT implementation this can make a difference in the future