RE: [PHP-DEV] RFC: Short syntax for Arrays (redux)
| From: | John Crenshaw | Date: | Wed, 01 Jun 2011 23:28:02 +0000 |
| Subject: | RE: [PHP-DEV] RFC: Short syntax for Arrays (redux) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52730@lists.php.net to get a copy of this message | ||
I don't think anyone cares about JSON for the sake of being perfect JSON, I didn't intend
to give that impression. I'm only hoping for something that generally works on par with all the
other JSON parsers in the world. In other words something with roughly the same syntax, constraints,
and flexibility as the average browser based JavaScript implementation. Making JSON some special
totally separate object type would totally miss the point and meaning of any developer writing such
code. Yes, JSON is a very specific encoding, but when a developer writes something
"jsony", what they mean is "an object/array with the following
structure/values", because that is what the encoding really represents.
John Crenshaw
Priacta, Inc.
-----Original Message-----
From: dukeofgaming [mailto:dukeofgaming@gmail.com]
Sent: Wednesday, June 01, 2011 6:52 PM
To: Michael Shadle
Cc: Sean Coates; Anthony Ferrara; PHP internals
Subject: Re: [PHP-DEV] RFC: Short syntax for Arrays (redux)
I still don't get it, the idea of making it look like json wont make it
json, it will be PHP, and if you dare to write you "jsony" object/array with
single quoted strings wont break the code even when its not JSON.
I'll say it again: not even Javascript supports 100% valid JSON. I'll say it
even more times:
Not even Javascript supports 100% valid JSON
Not even Javascript supports 100% valid JSON
Not even Javascript supports 100% valid JSON
Not even Javascript supports 100% valid JSON
Not even Javascript supports 100% valid JSON
JSON even has its own mime type. The idea of JSON as a first-class citizen
is a fallacy IMHO. The concept itsel is not ugly, but for god's sake, lets
put it in a separate RFC and lets decide con the actual RFC. Perhaps the
JSON idea could benefit from autoboxing and a native class?:
https://wiki.php.net/rfc/autoboxing
JSON is a serializarion format, not a data structure, you coud write an
associative array and if PHP knew the way, it could be autointerpreted as
JSON, no need to make PHP code look like JSON. I think that the *BEHAVIOR*
of arrays/objects as JSON and without the intervention of serialization
functions should be in a separate RFC. There is really no point to make PHP
*look* like JSON to handle JSON natively .
This JSON matter and short array/object syntax are different issues just the
way "<?=" and "<?" were.
Could someone get Douglas Crockford in here?, rofl.
Regards,
David