5 ms·
Comments about removing comments thus far seem to miss the point. By removing comments, he greatly simplified the parser. Since he was sure to be criticized for
by warmfuzzykitten 14y ago
Comments about removing comments thus far seem to miss the point. By removing comments, he greatly simplified the parser. Since he was sure to be criticized for this design choice in the direction of simplicity, it was a brave decision! Had there been enough radical simplifiers on the XML committee, we might not have needed JSON. Wait... Committee? Never mind.
- burgerbrain 14y agoI have a hard time believing that the removal of comments would greatly simplify a JSON parser.
- mturmon 14y agoThere would have been demands for tools that transform JSON to JSON, or JSON to XML, to preserve comments across the transformation. Adding that capability would raise the complexity of the parser, because comments would have to be made part of the data structure that is built and transformed. For instance, it would be harder to embed the data structure for the JSON in JS objects. But yes, for a parser that's ingesting data for immediate processing and has no need for comments, there's no discernable win regarding parsing simplicity.
- gnuvince 14y agoGreatly simplified the parser? It's probably 10 lines of code.
- webignition 14y agoThat'll be 10 * K lines of code, where K is the underestimation factor. Not to mention N unit tests to cover comment removal verification.
- doomslice 14y agohttp://coding.smashingmagazine.com/2012/04/27/yahoos-doug-crockford-on-javascript/ http://coding.smashingmagazine.com/2012/04/27/yahoos-doug-cr... "One interesting story about leaving things out: as we got closer to releasing JSON I decided to take out the ability to do comments. When translating JSON into other languages, often times the commenting piece was the most complicated part. By taking the commenting out we reduced the complexity of the parsers by half—everything else was just too simple."