The issue I have with that is that, regardless of the syntax chosen, even if it meant a 100% inline JSON syntax, you would still (for obvious reasons) need to parse any JSON string into PHP structures. You still have to do json_load($php_or_json_string) or (god have mercy) eval($string). At that point, the only convenience you get from having JSON syntax in php is the situational ability to copy a JSON string directly into your source code.
I just don't think that's worth introducing a new kind of array/object syntax into PHP. I might prefer that syntax (like python) but I don't think it's right for this language. On Jun 1, 2011, at 6:28 PM, John Crenshaw wrote: > 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:dukeofgam...@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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php