Re: [RFC] Bare Name Array
| From: | Ferenc Kovacs | Date: | Mon, 02 Jun 2014 08:55:24 +0000 |
| Subject: | Re: [RFC] Bare Name Array | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-74693@lists.php.net to get a copy of this message | ||
On Sun, Jun 1, 2014 at 8:37 PM, Andrea Faulds <ajf@ajf.me> wrote:
>
> On 1 Jun 2014, at 19:13, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
>
> > You can already do stringKey => 3 :)
>
> Yes, but then you’ll get:
> Notice: Use of undefined constant stringKey - assumed 'stringKey'
> in Command line code on line 1
>
> > And saving characters is not really
> > a big priority.
>
> Well, we already replaced array() with []. I think it is reasonable to
> consider saving characters in other places. It’s not a *big* priority, no,
> and we shouldn’t do it excessively, but if common cases are cumbersome, we
> should try to deal with them.
>
> Array literals with string keys and dereferencing arrays with string keys
> are extremely common in PHP. So I think this reduction would benefit most
> users, especially those who deal with JSON and the like (which I do a lot
> in my on code), as this makes declaring arrays to be serialised more
> convenient. Also, foobar: just looks nicer than “foobar” =>, especially
> when you have syntax highlighting.
>
>
originally JSON(or what it ended up as JSON) didn't require the keys to be
quoted, but it didn't took too long to bump into a reserved keyword and
realize that it is better to require the keys to be quoted:
https://www.youtube.com/watch?v=-C-JoyNuQJs#3m30s
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu