Re: [RFC] Bare Name Array
| From: | Rafael Kassner | Date: | Sun, 01 Jun 2014 19:23:37 +0000 |
| Subject: | Re: [RFC] Bare Name Array | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74674@lists.php.net to get a copy of this message | ||
Sorry, I didn't realize that this would not change the current behaviour.
Should be possible to mix both declarations?
define('FOO', 'bar');
> $data = array(FOO => 'bar', FOO :> 'baz');
On Sun, Jun 1, 2014 at 4:09 PM, Andrea Faulds <ajf@ajf.me> wrote:
>
> 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/
>
>
>
>
>