Live data from Hacker News

A modest proposal

happyassassin.net

71–80 of 189 posts

Re: A modest proposal

#71
post #29

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/

Since we're going off-topic about QV here: am I correct in my understanding that you can _buy_ votes there? Because the obvious problem (because I'm probably missing something) with that would be that money is not as costly for some as it is for others? In other words, it'd lead to tyranny of the wealthy?

Re: A modest proposal

#72
post #49

Between 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?

Protocol Buffer?

Re: A modest proposal

#73
post #33

Earlier 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…

> Not sure what the rationale for commas in lists is, though.

Well, you need some separator, and spaces won't do since [x y] has x applied to y.

Re: A modest proposal

#74
post #64

Earlier 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?

You can blame Crockford for that: [1]

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

#75
post #29
post #13

Earlier 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.

I was thinking the same before actually using rust. Turns out it surprisingly awesome given how rust treats statements and expressions.

it just makes obvious that "result of something" and "control flow back to caller" are very different things.

Re: A modest proposal

#76
post #26
post #6

Earlier 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...

Not if you want your code to work in certain versions of Internet Explorer :(

Re: A modest proposal

#77
post #57

I'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.

Anyone looking for a “better JSON” night was well just move to YAML. Someone managed to make JSON5 the config format for something here and we wasted way too long before switching that over to YAML. Now we have a bunch of JSON5 with comments we’ve gotta manually transcribe.

Re: A modest proposal

#80
post #57

I'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.

You can always parse using an eval. I guess it should work.

/me ducks.

Post reply on HN