Re: RFC: Short syntax for Arrays (redux)
| From: | Rasmus | Date: | Tue, 31 May 2011 21:16:39 +0000 |
| Subject: | Re: RFC: Short syntax for Arrays (redux) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52579@lists.php.net to get a copy of this message | ||
On 05/31/2011 11:52 AM, Sean Coates wrote:
> I'm one of the people who've brought it up on Twitter. Today's discussion seems
> to have earned some traction, which is a step in the right direction, I believe.
>
>> I would prefer (as Rasmus pointed out) not to start a long discussion about it. Primarily I
>> would be curious if anyone on the lists (from the RFC wiki page) below would like to change your
>> vote or if you are not listed below and would like to be counted, that would be great too.
>
> At risk of turning this into a longer-than-necessary discussion, I believe a new RFC is
> required at this point. Making [ and ] work as (T_ARRAY, '(') and (')'),
> respectively is no longer good enough, for the main reason you've pointed out: JSON is becoming
> ubiquitous; actual first-class JSON would be very valuable to me.
The tricky part with going all json is the syntax, specifically the {}'s
But I think it is doable, mostly because this is not valid today:
$a = true ? { 1 : 2 };
And in json if you have {}'s you have to have a ':' inside.
I have always preferred to "borrow" a familiar syntax from other
languages that the average PHP user is comfortable with instead of
making up a new one.
Stas, I didn't understand your point about eval() and security. What did
you mean?
-Rasmus