Re: RFC: Short syntax for Arrays (redux)
| From: | Matt Wilson | Date: | Tue, 31 May 2011 21:47:59 +0000 |
| Subject: | Re: RFC: Short syntax for Arrays (redux) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52592@lists.php.net to get a copy of this message | ||
Would seem to me a more elegant solution would to just drop the idea of json interoperability and go
with something that works for PHP.
('a'=>'b', 0=>1234) perhaps?
On May 31, 2011, at 4:45 PM, Ilia Alshanetsky wrote:
> Rasmus,
>
> Don't you think having support for both ['a':1, 'b':2] and
> {'a':1,
> 'b':2} would create confusion?
>
> On Tue, May 31, 2011 at 11:16 PM, Rasmus <rasmus@lerdorf.com> wrote:
>> 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
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>