Live data from Hacker News

A modest proposal

happyassassin.net

41–50 of 189 posts

Re: A modest proposal

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

Re: A modest proposal

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

No it isn’t. In practice it’s extremely obvious when it is happening. And if you mess up and add a semi colon accidentally then the type checker will catch it.

Re: A modest proposal

#43
post #15

I would love to have trailing commas in JSON but I can see that being JSON something too widely extended over the internet it's not possible to do it for real as it will break all around. So, what I do is to have my editor to fix this issue as I'm completely unable to stop doing it :-)

Seems like a perfectly backwards-compatible change to me.

Re: A modest proposal

#44
post #4

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.

Why would it ever matter that keys are duplicated? It should always be compressed when going over the wire anyway

Re: A modest proposal

#45
When I use JSON, I usually make sure that the parser supports trailing commas and comments, even if I have to add that myself. The reason is that I deal a lot with machine-generated but potentially user-edited JSON. Anything else is needlessly masochistic.

When producing JSON for others, I just use the minimal consensus format (read: the "official" spec).

Re: A modest proposal

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

[deleted]

Re: A modest proposal

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

Re: A modest proposal

#50
post #4

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.

The use case of JSON is to be able to read structured data from dynamic languages, with a single line of code and no preparation otherwise. It fits this purpose and it works well if you know the layout of the input.

As a storage format I don't like it, either. No canonical representation (at all): Arbitrary whitespace, arbitrary order of members. Too much line noise: Quotes around each member name. No schema support.

Post reply on HN