Re: Re: RFC: Short syntax for Arrays (redux)
| From: | Rune Kaagaard | Date: | Wed, 01 Jun 2011 09:55:10 +0000 |
| Subject: | Re: Re: RFC: Short syntax for Arrays (redux) | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52646@lists.php.net to get a copy of this message | ||
Big +1 on the patch. The ":" although a better choice would be
asymmetric to how its done inside array().
On Wed, Jun 1, 2011 at 11:50 AM, dukeofgaming <dukeofgaming@gmail.com> wrote:
> After that argument, I think I'm against ":" now too. +1 to "=>"
>
> Could "{ }" be implemented for objects too then?.
>
> Regards,
>
> David
>
> On Wed, Jun 1, 2011 at 4:36 AM, Ford, Mike <M.Ford@leedsmet.ac.uk> wrote:
>
>> > -----Original Message-----
>> > From: ekneuss@gmail.com [mailto:ekneuss@gmail.com] On Behalf Of
>> > Etienne Kneuss
>> > Sent: 01 June 2011 01:57
>> > To: internals@lists.php.net
>> > Subject: Re: [PHP-DEV] Re: RFC: Short syntax for Arrays (redux)
>> >
>> > +1 for a short array syntax.
>> >
>> > But only if you keep it consistent, PHP has always been using => for
>> > key/val association, I don't see any reason to suddenly provide
>> > "key":
>> > "val", unless what you want is to confuse people.
>>
>> Hear, hear and hear, hear to that!
>>
>> ['a': 'b'] just feels completely un-PHP-like, and I'd be totally
>> against it.
>>
>> If the desire is to have a "native" JSON syntax so that you can eval()
>> imported JSON, then I'm completely anti that, too -- that's a case
>> where I'd far rather be explicit and use json_decode(). And since, no
>> matter how you slice it, you're never going to get a complete fit
>> between native PHP structures and JSON encoding, I don't believe you
>> should even try.
>>
>> I just can't see the problem with saying: PHP arrays (and maybe
>> objects?) look like *this*, and if you want to import/export them
>> from/to a JSON representation, there are functions to do it like
>> *this*. This seems to be the perfectly sensible approach of other
>> languages I've used recently (although my perl is somewhat out-of-date,
>> and my python even more out-of-daterer and minimal at that!). Even
>> ECMAScript is going down the route of explicit conversion with
>> JSON.parse() and JSON.stringify() in ECMAScript 5!
>>
>> All in all, still +1 for [1, 2=>2, 'a'=>'b'], and -several
>> million (for
>> style) for any syntax involving colons.
>>
>> Cheers!
>>
>> Mike
>> --
>> Mike Ford,
>> Electronic Information Developer, Libraries and Learning Innovation,
>> Leeds Metropolitan University, C507 City Campus,
>> Portland Way, LEEDS, LS1 3HE, United Kingdom
>> E: m.ford@leedsmet.ac.uk T: +44 113 812 4730
>>
>>
>>
>>
>>
>>
>> To view the terms under which this email is distributed, please go to
>> http://disclaimer.leedsmet.ac.uk/email.htm
>>
>