Re: Re: RFC: Short syntax for Arrays (redux)
| From: | Marcel Esser | Date: | Tue, 31 May 2011 23:39:07 +0000 |
| Subject: | Re: Re: RFC: Short syntax for Arrays (redux) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52613@lists.php.net to get a copy of this message | ||
Yeah, you'll note I am not actually advocating making a full JSON
implementation in the PHP language.
However, as per your point, JSON is no longer just a machine interchange
format. It's many other things these days, including a query definition
protocol. It's unlikely that the number of systems that use JSON as a
descriptor or filter will decrease in the near future; many people are
implementing JSON subsets or supersets in this format. And, as mentioned,
that turns into a ton of typing when you start getting deeply nested - in
a way that is not nearly as straight-forward as functionally identical
JSON-like notation.
So, considering all that, there is no real reason that I can see why it
shouldn't be possible to facilitate the developer with an ability to more
easily express these more complicated, nested examples.
That's why everyone in Mexico was cheering.
- M.
--
Marcel Esser
Vice President of Engineering, CROSCON
+1 (202) 470-6090
marcel.esser@croscon.com
Before printing this e-mail, please consider the rainforest.
On 5/31/11 7:30 PM, "Michael Shadle" <mike503@gmail.com> wrote:
>I've always considered json an awesome machine to machine interchange
>format (the most efficient one) but not the easiest to read for
>configuration or manually defining anything.
>
>I see nothing wrong with the initial example. Has worked well for years.
>:)
>
>
>On May 31, 2011, at 3:43 PM, Marcel Esser <marcel.esser@croscon.com>
>wrote:
>
>> From the perspective of someone that's just trying to get stuff done:
>>
>> $packet = array('response' => array('status' =>
1,'message' =>
>>''),'data' => array('id' => 1, 'username'
=> 'john doe'));
>>
>> $packet = ['response': ['status': 1, 'message': '',
'data': ['id': 1,
>>'username': 'john doe'] ] ];
>>
>> The clarity improvement above is an exponential function that gets
>>better and better the more deeply nested you are. I don't know anyone
>>that needs the ability to support full JSON notation in PHP, but there
>>are entirely too many deeply nested array() declarations with lots of
>>tabs in our lives, especially when we start working with things like
>>JSON and/or Mongo or xyz.
>>
>> That's all I wanted to say to this.
>>
>> Cheers,
>> M.
>>
>> --
>> Marcel Esser
>> Vice President of Engineering, CROSCON
>> +1 (202) 470-6090
>> marcel.esser@croscon.com
>>
>> Before printing this e-mail, please consider the rainforest.