I really dislike JSON. It's better than XML, but not by much. There are several fundamental problems with JSON, one of which being that you have to duplicate the field names over and over again. It's just not a very structured format. Trailing commas is the least of my concerns. I would like to see protobuf take over at this point.
A modest proposal
21–30 of 189 posts
Re: A modest proposal
#22Yes, please! This applies to many other lists as well, not only restricted to JSON. Besides, imagine a world of Java, Javascript, C-like anything, where you would be DISALLOWED to have a semicolon after the last statement in a block. Crazy thought, right?
Commas are unnecessary. There is zero benefit to having them. The code is actually easier to parse if you just remove them from the rules list entirely. No commas might look weird for a day or so, but you quickly get used to it. (I'm ignoring the comma operator, which is a special case and not relevant to the main point.)
foo(x, -y)
is not the same as foo(x -y)
(from your last sentence, I assume you were talking about JS in general, not just JSON)Re: A modest proposal
#23Re: A modest proposal
#24Earlier quoted context omitted.
Commas are unnecessary. There is zero benefit to having them. The code is actually easier to parse if you just remove them from the rules list entirely. No commas might look weird for a day or so, but you quickly get used to it. (I'm ignoring the comma operator, which is a special case and not relevant to the main point.)
They exist because of string concatenation. In some languages any consecutive strings are implicitly concatenated so that you can have a very long string split across many lines.
Re: A modest proposal
#25Earlier quoted context omitted.
Commas are unnecessary. There is zero benefit to having them. The code is actually easier to parse if you just remove them from the rules list entirely. No commas might look weird for a day or so, but you quickly get used to it. (I'm ignoring the comma operator, which is a special case and not relevant to the main point.)
foo(x, -y) is not the same as foo(x -y) (from your last sentence, I assume you were talking about JS in general, not just JSON)
Never mind.
Actually, let's double down: Instead of writing 1+2, you should really be writing +(1 2). Don't you see how much easier that would make things? A single, uniform syntax everywhere! + is just a function that gets called like anything else! Your foo(x -y) example would become foo(x -(y)).
I'm mostly joking.
Re: A modest proposal
#26Yes, please! This applies to many other lists as well, not only restricted to JSON. Besides, imagine a world of Java, Javascript, C-like anything, where you would be DISALLOWED to have a semicolon after the last statement in a block. Crazy thought, right?
Javascript: automatically inserts semicolons for you at the end of a line, but doesn't allow commas at the end of a list.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re: A modest proposal
#27Yes, please! This applies to many other lists as well, not only restricted to JSON. Besides, imagine a world of Java, Javascript, C-like anything, where you would be DISALLOWED to have a semicolon after the last statement in a block. Crazy thought, right?
Some JavaScript style standards require no semicolons at the end of lines: https://standardjs.com/rules.html#semicolons
Re: A modest proposal
#28Yes, please! This applies to many other lists as well, not only restricted to JSON. Besides, imagine a world of Java, Javascript, C-like anything, where you would be DISALLOWED to have a semicolon after the last statement in a block. Crazy thought, right?
Some JavaScript style standards require no semicolons at the end of lines: https://standardjs.com/rules.html#semicolons
Re: A modest proposal
#29Yes, please! This applies to many other lists as well, not only restricted to JSON. Besides, imagine a world of Java, Javascript, C-like anything, where you would be DISALLOWED to have a semicolon after the last statement in a block. Crazy thought, right?
In Rust, omitting the last semicolon in a block indicates an implicit return of the final expression of the block.