Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70050 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18202 invoked from network); 7 Nov 2013 12:41:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Nov 2013 12:41:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.42 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.219.42 mail-oa0-f42.google.com Received: from [209.85.219.42] ([209.85.219.42:39443] helo=mail-oa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/50-16506-69A8B725 for ; Thu, 07 Nov 2013 07:41:58 -0500 Received: by mail-oa0-f42.google.com with SMTP id l6so886795oag.29 for ; Thu, 07 Nov 2013 04:41:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=7WthDdL+1lpcvJGbGMinenZeAMnhZqjiJ1KCM4UP8J0=; b=NMCoT789Sw0UjeSjQtpBlmODalQE28Ho4xBfG6G454B5ZmkGem0XjMgmWIqABae31Z rJpKnpI3d/pRiEbaJGTs2YxRJFQfY+7rK6JzjSHVyq5DPKBzzwOhP53zDlv/GBkX3Wt9 31Q0yM1B3HOnMPk9rbvwK67pxncozK49aezig9hHAaYL+wZeO9hy+Ses26s5NlZvASCC WaAHUGo3VbjgINqtudLpjAO+XMrdHTpd61l0uqSig8SEA8fE225hC826tZdY2OMTuM1H Nyh00vQ6SrUVzLqAX9YjAJaYmV9ijlgmFIx8jP5VEZK0xPlpMfBh5p5pQ1SQKnbp95pl 5yPA== MIME-Version: 1.0 X-Received: by 10.60.62.172 with SMTP id z12mr6532433oer.4.1383828115476; Thu, 07 Nov 2013 04:41:55 -0800 (PST) Received: by 10.182.54.112 with HTTP; Thu, 7 Nov 2013 04:41:55 -0800 (PST) In-Reply-To: <4DBA0F2B-4B6B-4A19-9B53-9C16352D1D71@strojny.net> References: <4DBA0F2B-4B6B-4A19-9B53-9C16352D1D71@strojny.net> Date: Thu, 7 Nov 2013 13:41:55 +0100 Message-ID: To: Lars Strojny Cc: Bob Weinand , List PHP Mailing List , Dmitry Stogov Content-Type: multipart/alternative; boundary=001a11c2097640d86f04ea959792 Subject: Re: [PHP-DEV] [RFC] Constant Scalar Expressions (with constants) From: nikita.ppv@gmail.com (Nikita Popov) --001a11c2097640d86f04ea959792 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Thu, Nov 7, 2013 at 1:31 PM, Lars Strojny wrote: > Hi Bob, > > thanks for your work, it=92s awesome. One thing about constants: > > Take this example: > > const FOO =3D 2; > > class Klass > { > const FOO =3D 1; > const BAR =3D FOO; > } > > 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 sugges= t > to always force prefixing the constant to get rid of the ambiguity and > allow for future extension. > > const FOO =3D 2; > > class Klass > { > const FOO =3D 1; > const BAR =3D self::FOO; > } > > Does that make sense? > The code snippets you posted are *already* supported (e.g. in PHP 5.5). FOO will resolve to the globals constant, self::FOO to the class constant. Presumably the extended support in static expressions will retain those semantics :) Nikita --001a11c2097640d86f04ea959792--