Live data from Hacker News

A modest proposal

happyassassin.net

91–100 of 189 posts

Re: A modest proposal

#91
Seeing as the vast majority of statements while coding aren't multiline, I wish there was a symbol to indicate that instead of a symbol to represent the end of a single line statement. I think Python has things right with the significant whitespace as well as it seriously reduces annoying errors caused by misbalanced brackets/braces.

Going further with this, I wish languages would be more copy/paste friendly. For example, in JavaScript I'll sometimes change code along the lines of

    a.x = 1;
    a.y = 2;
to

    a = {
        x: 1,
        y: 2
    };"
If you eliminate the commas, semicolons and changed the colons/equals to the same thing, you could copy/paste it with much less hassle.

Re: A modest proposal

#92

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.

It may be used as such but it shouldn't be. YAML serves this purpose much better. JSON works better as a language independent serialization format that is incidentally readable.

Yeah json is a fact of life, the fact yaml exists doesn't change that. Actually, toml is even better than yaml and yet...

Re: A modest proposal

#93
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.

Trailing commas are commonly allowed in the subset of JS that is JSON, but I believe most JSON parsing libraries disallow them.

Re: A modest proposal

#95

Seeing as the vast majority of statements while coding aren't multiline, I wish there was a symbol to indicate that instead of a symbol to represent the end of a single line statement. I think Python has things right with the significant whitespace as well as it seriously reduces annoying errors caused by misbalanced brackets/braces. Going further with this, I wish languages would be more copy/paste friendly. For exa…

> Seeing as the vast majority of statements while coding aren't multiline, I wish there was a symbol to indicate that

I dunno, that kind of exists in some bash/scripting contexts (using a backslash) and I've never enjoyed it.

Re: A modest proposal

#96

Earlier quoted context omitted.

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

Yeah...that's frustrating. For a Chrome Extension manifest JSON file I was recently editing, you have to enter a description field that I found out is limited to around 100 characters after a failed upload. I wanted to add a comment above this field so myself and anyone else editing the file was aware of this in the future (a good use of comments in my opinion). I'm not going go through the hassle of a build step to do this. Programming languages allow comments for a reason and I don't see what's so different about JSON.

Re: A modest proposal

#98
post #64

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.

There is a damned good reason JSON does not allow comments. It's not an accident.

gotta love the hn community, downvoting things that are correct but hurt them feels

Re: A modest proposal

#99
post #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.

First, JSON is not just used for config, and I've yet to find the an API to parse YAML in the browser natively.

Secondly, JSON is here and you have to deal with it everyday, so smoothing the work wouldn't hurt.

Finally, if you have to pick a format, take TOML. Less error prone than YAML, faster, and injecting executable code and shooting your in the foot is not part of the standard. The fact that a lot of ini files are valid toml is a nice bonus.

Re: A modest proposal

#100
post #55
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.

How do you feel about the ! operator?

I won't even get started. I see no reason why a modern language would use it in preference to "not" (like Python).
Post reply on HN