Re: [RFC] Constant Scalar Expressions (with constants)
| From: | Lars Strojny | Date: | Thu, 07 Nov 2013 12:31:14 +0000 |
| Subject: | Re: [RFC] Constant Scalar Expressions (with constants) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70049@lists.php.net to get a copy of this message | ||
Hi Bob,
thanks for your work, it’s awesome. One thing about constants:
Take this example:
const FOO = 2;
class Klass
{
const FOO = 1;
const BAR = 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 suggest to always force prefixing the constant to get
rid of the ambiguity and allow for future extension.
const FOO = 2;
class Klass
{
const FOO = 1;
const BAR = self::FOO;
}
Does that make sense?
cu,
Lars
On 07 Nov 2013, at 13:01, Bob Weinand <bobwei9@hotmail.com> wrote:
> Hi!
>
> As you all know, Anthony Ferrara had withdrawn his RFC a few months ago, which was without
> support for constants in these expressions:
>
> const foo = 10;
> const bar = 10 * foo;
>
> The use of a constant in a declaration of a constant was not yet possible with his patch.
>
> That's what I changed.
>
> Enjoy reading the RFC at:
>
> https://wiki.php.net/rfc/const_scalar_exprs
>
> Bob Weinand
>
> 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
>
Attachment: [application/pgp-signature] Message signed with OpenPGP using GPGMail signature.asc
Attachment: [application/pgp-signature] Message signed with OpenPGP using GPGMail signature.asc