3 ms·
I always hated this logic, the "I know better than you". You can still add pragmas trivially in JSON, this doesn't prevent that problem, it just makes it more c
by Salgat 3y ago
I always hated this logic, the "I know better than you". You can still add pragmas trivially in JSON, this doesn't prevent that problem, it just makes it more convoluted at the expense of a powerful documentation feature.
- anonzzzies 3y agoThis really never made sense; I find adding property like __pragma: nicer than comments. It has the same problem as he stated, but leaving out comments is not going to prevent that; it was a bad idea IMHO. I use hjson just for the comments; it's excellent.
- masklinn 3y ago> This really never made sense It always made perfect sense, given JSON was invented as a data exchange format. It was never intended to be written out by hand. > I find adding property like __pragma: nicer than comments. It has the same problem as he stated It does not, because that is data which every JSON parser will at least parse if not interpret. A comment is something a parser has no reason to yield, which means smuggling metadata in comments makes the document itself inconsistent between parsers which do and parsers which don't[0] expose comments. And this was not a fancy Crockford made up, smuggling processing instructions in comments was ubiquitous in Java at the time, as well as HTML/XML, where it literally still is a thing: https://en.wikipedia.org/wiki/Conditional_comment https://en.wikipedia.org/wiki/Conditional_comment. [0] and possibly can't, how do you deserialize a comment in the middle of an object to JS or Ruby
- throw0101a 3y ago> I always hated this logic, the "I know better than you". Feel free to create your own data interchange file format. (Perhaps with Blackjack and hookers. :) > You can still add pragmas trivially in JSON, this doesn't prevent that problem, it just makes it more convoluted at the expense of a powerful documentation feature. Computers/systems do not need comments to exchange data between themselves, and that is the problem JSON is trying to solve: data exchange. If you're using it for configuration and other human-centric tasks, and wish to communicate human-centric things in the file, you're trying to fit a square peg into a round hole. Use some other format that was designed with those things in mind. If you're saying the designers of a hammer didn't think of being able to handle Robertson screws you're unfairly critiquing the tool.
- Salgat 3y ago> Feel free to create your own data interchange file format. This is such a lazy argument to make. We are both allowed to criticize flaws in data exchange formats. As far as what JSON is trying to solve, it's far beyond that, and the creator knew this (which is why he went out of his way to fight it). If you as a human have ever debugged anything dealing with a json handling, you've already proven that comments can have value.
- deleted 3y ago[deleted]
- tracker1 3y agoAnd still JSON is less of a pain than XML... ;-)
- stjohnswarts 3y agoIt's a square peg that fits very nicely in the round hole I use it for, so Imma continue to use it as I see fit.