Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70248 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70275 invoked from network); 20 Nov 2013 21:11:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Nov 2013 21:11:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.140 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.140 blu0-omc4-s1.blu0.hotmail.com Windows 2000 SP4, XP SP1 Received: from [65.55.111.140] ([65.55.111.140:5681] helo=blu0-omc4-s1.blu0.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 90/E2-51208-C852D825 for ; Wed, 20 Nov 2013 16:11:40 -0500 Received: from BLU0-SMTP187 ([65.55.111.136]) by blu0-omc4-s1.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 20 Nov 2013 13:11:37 -0800 X-TMN: [8+WY9EINpQMcgzjbhIZf3vlPb+WND9nu] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Received: from bobweinandsimac.fritz.box ([83.99.63.185]) by BLU0-SMTP187.phx.gbl over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 20 Nov 2013 13:11:34 -0800 Content-Type: multipart/alternative; boundary="Apple-Mail=_DA89C20D-6DA0-4FA6-99C2-00DF0BEA47A6" MIME-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) In-Reply-To: Date: Wed, 20 Nov 2013 22:11:31 +0100 CC: List PHP Mailing List References: To: Yasuo Ohgaki X-Mailer: Apple Mail (2.1822) X-OriginalArrivalTime: 20 Nov 2013 21:11:34.0593 (UTC) FILETIME=[17B84310:01CEE635] Subject: Re: [PHP-DEV] [RFC] [VOTE] Constant scalar expressions From: bobwei9@hotmail.com (Bob Weinand) --Apple-Mail=_DA89C20D-6DA0-4FA6-99C2-00DF0BEA47A6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" Am 20.11.2013 um 21:55 schrieb Yasuo Ohgaki : > Hi Bob, >=20 > On Thu, Nov 21, 2013 at 5:17 AM, Bob Weinand = wrote: > As noted in the RFC "The patch is ready to be merged. (Opcache support = is included, thanks to Dmitry)". >=20 > So, Dmitry already did the patch for opcache and I assume he has done = the best possible for that. >=20 > Btw. opcache doesn't affect constants if I'm not wrong, because, what = would you optimize here (already possible): >=20 > a.php: > if ($argv[1] =3D=3D "include") > include 'b.php'; > const B =3D A; >=20 > b.php: > const A =3D 10; >=20 > Here we can't cache anything because the constant B depends on a = conditional inclusion: same problem. >=20 > It's that same way resolved with the current patch. >=20 > Also constant expressions (like 2+2 without constants involved) are = resolved at compile time. >=20 > So I can't detect any impact related to opcache. >=20 > I thought whole point of introducing "const" while we have define() = was to make=20 > constant cachable in ops. >=20 > Anyway, I'll vote 'yes' in that case. >=20 > Thank you. >=20 > BTW, any reason why there is no constant array? >=20 > -- > Yasuo Ohgaki=20 > yohgaki@ohgaki.net Hi, That'd just be outside of this RFC's scope: const ABC =3D [1, 2]; is currently not allowed. Also you can't write ABC[0]. That'd be a whole = other RFC to add array support for constants. So we could enable it for (static) properties, but why should we? Additions of arrays would be the only valid operation, but can you = imagine _any_ use case where we'd need that when the only dynamic = operands (constants) can't be arrays? Bob --Apple-Mail=_DA89C20D-6DA0-4FA6-99C2-00DF0BEA47A6--