Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70052 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21054 invoked from network); 7 Nov 2013 12:45:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Nov 2013 12:45:37 -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.116.35 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.116.35 blu0-omc1-s24.blu0.hotmail.com Windows 2000 SP4, XP SP1 Received: from [65.55.116.35] ([65.55.116.35:63928] helo=blu0-omc1-s24.blu0.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/01-16506-07B8B725 for ; Thu, 07 Nov 2013 07:45:37 -0500 Received: from BLU0-SMTP58 ([65.55.116.9]) by blu0-omc1-s24.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 7 Nov 2013 04:45:33 -0800 X-TMN: [teKBdhrjY9H/DqUyFfqGe82vm0LwnN2k] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Received: from bobweinandsimac.fritz.box ([83.99.63.185]) by BLU0-SMTP58.phx.gbl over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 7 Nov 2013 04:45:30 -0800 Content-Type: text/plain; charset="windows-1252" MIME-Version: 1.0 (Mac OS X Mail 7.0 \(1816\)) In-Reply-To: <4DBA0F2B-4B6B-4A19-9B53-9C16352D1D71@strojny.net> Date: Thu, 7 Nov 2013 13:45:25 +0100 CC: List PHP Mailing List , Dmitry Stogov Content-Transfer-Encoding: quoted-printable References: <4DBA0F2B-4B6B-4A19-9B53-9C16352D1D71@strojny.net> To: Lars Strojny X-Mailer: Apple Mail (2.1816) X-OriginalArrivalTime: 07 Nov 2013 12:45:30.0723 (UTC) FILETIME=[3E12A330:01CEDBB7] Subject: Re: [PHP-DEV] [RFC] Constant Scalar Expressions (with constants) From: bobwei9@hotmail.com (Bob Weinand) Hi Lars, In what way is this ambiguous? I just tested; FOO never equals self::FOO. FOO always is a global = constant, while self::FOO (and Klass::FOO) is the only way to refer to = the class constant. const FOO =3D 2; class Klass { const FOO =3D 1; const BAR =3D FOO; // value two, global constant, and if FOO is not = defined, Klass::Bar =3D=3D=3D "FOO". } Bob Am 7.11.2013 um 13:31 schrieb Lars Strojny : > Hi Bob, >=20 > thanks for your work, it=92s awesome. One thing about constants: >=20 > Take this example: >=20 > const FOO =3D 2; >=20 > class Klass > { > const FOO =3D 1; > const BAR =3D FOO; > } >=20 > Here FOO is ambiguous, as it could resolve to 2 or to 1. If I = understood it correctly, global constants are not yet implemented but I = would suggest to always force prefixing the constant to get rid of the = ambiguity and allow for future extension. >=20 > const FOO =3D 2; >=20 > class Klass > { > const FOO =3D 1; > const BAR =3D self::FOO; > } >=20 > Does that make sense? >=20 > cu, > Lars >=20 > On 07 Nov 2013, at 13:01, Bob Weinand wrote: >=20 >> Hi! >>=20 >> As you all know, Anthony Ferrara had withdrawn his RFC a few months = ago, which was without support for constants in these expressions: >>=20 >> const foo =3D 10; >> const bar =3D 10 * foo; >>=20 >> The use of a constant in a declaration of a constant was not yet = possible with his patch. >>=20 >> That's what I changed. >>=20 >> Enjoy reading the RFC at: >>=20 >> https://wiki.php.net/rfc/const_scalar_exprs >>=20 >> Bob Weinand >>=20 >> Special thanks go to Dmitry who had helped me a lot with feedback and = a deep review of the patch. >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php