RE: [PHP-DEV] RFC: Short syntax for Arrays (redux)
| From: | Ford, Mike | Date: | Thu, 02 Jun 2011 09:49:40 +0000 |
| Subject: | RE: [PHP-DEV] RFC: Short syntax for Arrays (redux) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52743@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: John Crenshaw [mailto:johncrenshaw@priacta.com]
> Sent: 01 June 2011 23:00
>
> Spot on. It has nothing to do with extra typing (and that sort of
> design is part of what ruined Ruby). My fingers move plenty fast and
> if extra characters make things more safe or more readable, I'll be
> the first to sign up. In this case, however, the extra characters
> just make things messy.
> 1. The most readable format is pure JSON
Matter of opinion. I don't agree.
> 2. The most familiar format is pure JSON (because these same
> developers are almost certainly already using it in their jQuery
> code)
Also matter of opinion, and of experience. Apart from the fact that
my use of jQuery amounts to a few weeks out of a (mumble)-year
programming career, no I don't use pure JSON for it - Javascript
object literals, yes, but not pure JSON.
> 3. The most compact format is pure JSON
Um. Depends. I would tend to write 'a': 'b' in JSON, but
'a'=>'b'
in PHP. But YMMV.
> 4. The format most consistent with other languages is JSON
Again, matter of experience. Last time I counted, I'd used upward of
30 different programming languages and dialects, some of which had
very bizarre ways of representing things, and none of which (apart
from Javascript!) used a JSON-like array-literal syntax. And,
actually, I *want* my PHP arrays to look different from my
Javascript/JSON arrays, especially as I might be looking at both as
part of the same project -- I *want* a big data structure to scream
"I'm PHP" or "I'm Javascript/JSON" at me, to help trigger my brain
into the right programming mode.
All of this is just IMHO, of course, and probably a lot more than my
regulation 2 pennorth, but there you go.
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