Re: RFC: Short syntax for Arrays (redux)
| From: | Sanford Whiteman | Date: | Thu, 02 Jun 2011 04:19:39 +0000 |
| Subject: | Re: RFC: Short syntax for Arrays (redux) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52733@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.
Then you should stop saying "pure JSON" and "true JSON" constantly!
> I'm only hoping for something that generally works on par with all
> the other JSON parsers in the world.
OK, that trashes your example, where values were set based on the
result of a PHP function. There is no "par" for JSON parsers running
methods _at creation time_, within the server (author) context.
Setting vars to the return value of a function is something we take
for granted in real languages, but it cannot happen within what a
knowledgeable person would call "JSON."
> 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.
Not Javascript developers. Maybe jQiddies think that
{'$gt': strtotime('-1 day')}
is "JSONy" more than it is "JS objecty"?
This is like starting from "Wouldn't inline CSVs be great for creating
arrays?" and drifting to "I mean, not like with that comma-escaping
stuff, and, uh, newlines would be allowed in the middle of a record,
and you'd have to allow create-time interpolation of function calls.
You know, CSVy!"
Only thing I might generously refer to as being "JSONy," while
provably not being valid JSON, is a string that conforms in every way
_except_ for using single quotes -- everywhere that doubles are
required -- instead of using doubles. Anything else is someone's
mangled "JankySON" or just not JSON.
-- S.