Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70055 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25852 invoked from network); 7 Nov 2013 13:10:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Nov 2013 13:10:23 -0000 Authentication-Results: pb1.pair.com header.from=lars@strojny.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lars@strojny.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain strojny.net from 46.4.40.248 cause and error) X-PHP-List-Original-Sender: lars@strojny.net X-Host-Fingerprint: 46.4.40.248 milch.schokokeks.org Received: from [46.4.40.248] ([46.4.40.248:40666] helo=milch.schokokeks.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EC/12-16506-D319B725 for ; Thu, 07 Nov 2013 08:10:22 -0500 Received: from [192.168.1.135] (p5099f5c8.dip0.t-ipconnect.de [::ffff:80.153.245.200]) (AUTH: PLAIN lars@schokokeks.org, TLS: TLSv1/SSLv3,128bits,AES128-SHA) by milch.schokokeks.org with ESMTPSA; Thu, 07 Nov 2013 14:10:12 +0100 id 0000000000000024.00000000527B9134.00003745 Content-Type: multipart/signed; boundary="Apple-Mail=_43806119-E647-419E-B29B-B390F220482B"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1816\)) In-Reply-To: Date: Thu, 7 Nov 2013 14:10:11 +0100 Cc: List PHP Mailing List , Dmitry Stogov Message-ID: References: <4DBA0F2B-4B6B-4A19-9B53-9C16352D1D71@strojny.net> To: Bob Weinand X-Mailer: Apple Mail (2.1816) Subject: Re: [PHP-DEV] [RFC] Constant Scalar Expressions (with constants) From: lars@strojny.net (Lars Strojny) --Apple-Mail=_43806119-E647-419E-B29B-B390F220482B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 Hi Bob, alright, my fault not getting the ternary operator example :) Thanks for the clarification! Lars On 07 Nov 2013, at 13:45, Bob Weinand wrote: > Hi Lars, >=20 > In what way is this ambiguous? >=20 > 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. >=20 > const FOO =3D 2; >=20 > 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". > } >=20 > Bob >=20 > Am 7.11.2013 um 13:31 schrieb Lars Strojny : >=20 >> 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 --Apple-Mail=_43806119-E647-419E-B29B-B390F220482B Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIVAwUBUnuRMyQPF+sCY6wHAQLhVw/+MW/n9dBygOMBEp2PM+WBg/LUP0bk5D8D G8Rapp1IM2OWtIR0fIpG9TIGttGRIcYbI2x1GkGDr6BUo/KDQpiABqwjLEa42g8Z peSM7QrmZZQvOVu8bYqL9avVuIQj6v0xnpcTRKJ/Be2H82nvG5J1r69oJnFkKdkF nNd6MCs3mIsglByCtBObXM0eQiE6dp3vpbiSHvhD9ATqvLbmPG/+4EO7YKyKrb4i ghXQ69VTcw0pDafkZUaQZAN24VM2EhQeSz5jSXh9VRR5Hswba4MGggm3MFVV+/ix WADuQ94htCaxR5eYHCcJw0BQ/09xHsk0nk2R/erh37LmT4VOPugGAGxPmDNEt+GZ 7MIP57Vgc+XukQ05nO0ZpfBfpeCRo9ReeZURbb+ONUfJpZ3DkLZY9wfCM3uGg9r6 iapNybRglF9/Rr4PY4EqP/S9a4D4KSk6XQp1WGAokSQQBP5PatGGbXQljU/X4lnm rj9Nz5v0R5Bo9S/Mp3xPSX+aEePHsBsh+9TgIp6WVEE9DTrG8uuNDvYmUNvl6b+e mmDcAqigMEtVoEheGT3EKVZ/ww82HeI9Adfgx4fGWKkOUF+f74jkAWO86F0TdC3B wSlGsMlpkTD6sz0NzTOZb3wCd3cDPWUouhfh6cIov4C2AkKeGWfEhPrHeqHvhOMk qk8bIxWaVtQ= =RKWR -----END PGP SIGNATURE----- --Apple-Mail=_43806119-E647-419E-B29B-B390F220482B--