Hacker News new | ask | show | jobs
by usrusr 1725 days ago
An annoying half-solution that breaks down as soon as you encounter content with both. Better imho to have one way and become good at it. I think I might even prefer trailing commas to be mandatory.
2 comments

It solves the problem like 99% of the time in my experience. It's very rare that I have content with both single and double quotes.
That's exactly my point: 99% solutions are the worst. Every 99% solution will eventually find someone relying on it, willingly or not. And it's always someone else cleaning up the mess (or failing to find the cause).
There is no mess.

The 99% case is a pretty string. The 1% case is a string with escaped delimiters.

Why does it need commas at all? What purpose do they serve?
They don’t serve one. Clojure uses only white space for distinguishing items in lists and hashmaps and after a short period of “this is weird” you embrace it and wonder why you ever needed commas at all
Checksums, basically, drawing a line between random bytes and structured JSON in a way that comes at zero cost for a human mind (arguably less than zero). We might as well leave out all closing tokens at the end of the stream, in a way those are completely redundant but still worth it for the warm, fuzzy feeling of knowing that you haven't just read a truncated stream.
It's either commas or significant whitespace. No matter what you'll find someone who hates one or the other.
But everyone puts the whitespace in anyway so why not just make it significant?