Re: [RFC] Bare Name Array
| From: | Andrea Faulds | Date: | Sun, 01 Jun 2014 19:09:35 +0000 |
| Subject: | Re: [RFC] Bare Name Array | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74673@lists.php.net to get a copy of this message | ||
On 1 Jun 2014, at 19:56, Rafael Kassner <kassner@php.net> wrote:
> You missed my point, I'm not saying about undefined constants, I'm saying
> about the usage of defined constants as array keys. If the array
> declaration don't expand constants to strings anymore, many code will
> break.
I haven’t changed that. => still works the same as ever. I’m adding a colon syntax which
takes a bare name instead of an expression.
> If we expand constants within array declaration, someone can mess up
> the code by adding a define() somewhere above and don't even realize what's
> wrong (constants have global scope).
But that’s how it works at present. People writing array(foo => 3) and assuming that’s the
same as array(‘foo’ => 3) need to try turning display_errors on.
--
Andrea Faulds
http://ajf.me/