Earlier quoted context omitted.
That's terrible, to have semantics depend on such a tiny syntax change that's so easy to miss.
I wish there was times that HN supported Quadratic Voting[0] so that I could more (but costly) up votes to a really sane and pertinent comment. [0] http://ericposner.com/quadratic-voting/
A modest proposal
71–80 of 189 posts
Re: A modest proposal
#72Between commas and comments, I would personally vote for comments. JSON is, unfortunately, used in many places as a configuration language (think package.json). Sometimes you have to comment out a section for some experiment. Many times, you want to explain why you included this or that in the config. Hence comments. The trailing commas issue is slightly annoying, but an order of magnitude less important IMHO.
Why not both?
Re: A modest proposal
#73Earlier quoted context omitted.
Mm, fair point. Infix math rears its ugly head again. I've been living in Lisp a bit too long. 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.
Haskell makes a reasonable job of combining infix operators with no commas between function arguments[1]. You sometimes end up with a few extra parentheses and $s instead, but things generally seem to work out. Does use commas for lists and tuples, though. The latter kind-of make sense, it's the commas that identify the expression as a tuple. Not sure what the rationale for commas in lists is, though. [1] Slightly co…
Well, you need some separator, and spaces won't do since [x y] has x applied to y.
Re: A modest proposal
#74Earlier quoted context omitted.
There is a damned good reason JSON does not allow comments. It's not an accident.
So can you fill the rest of us in on the reason then?
TLDR: Basically, in a typical Crockford move, he saw people were using them in a specific way he did not like (to store parsing parameters), so he removed them entirely. I say "typical Crockford" because some of his JS linting rules are gratuitous overkill in my opinion. He also suggests that if you want comments, you should pipe the config file through a minifier that removes them before parsing.
Doesn't seem like that much of a good reason to me, but whatever.
1. https://plus.google.com/+DouglasCrockfordEsq/posts/RK8qyGVaG...
Re: A modest proposal
#75Earlier quoted context omitted.
In Rust, omitting the last semicolon in a block indicates an implicit return of the final expression of the block.
That's terrible, to have semantics depend on such a tiny syntax change that's so easy to miss.
it just makes obvious that "result of something" and "control flow back to caller" are very different things.
Re: A modest proposal
#76Earlier quoted context omitted.
Javascript: automatically inserts semicolons for you at the end of a line, but doesn't allow commas at the end of a list.
JavaScript does allow commas at the end of a list! :) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re: A modest proposal
#77I'm surprised this got voted up considering how dismissive (and, frankly, mean) HN was to "JSON5" a few years back https://news.ycombinator.com/item?id=4031699 Trailing commas have been fine everywhere in JS since IE7 - it's about time all interpreters have this as an option, and preferably on by default.
Re: A modest proposal
#78Re: A modest proposal
#79Couldn't git take this into account to visually "depollute" diffs ?
Re: A modest proposal
#80I'm surprised this got voted up considering how dismissive (and, frankly, mean) HN was to "JSON5" a few years back https://news.ycombinator.com/item?id=4031699 Trailing commas have been fine everywhere in JS since IE7 - it's about time all interpreters have this as an option, and preferably on by default.
/me ducks.