top | item 45514936 (no title) RedNifre | 4 months ago If you already have quotation marks, what's the point of the commas? discuss order hn newest merelysounds|4 months ago This is a popular question, the most common answer I’ve seen is:> Commas exist mostly to help JSON be human-readable. They have no real syntactic purpose as one could make their own notation without the commas and it'd work just fine.https://stackoverflow.com/a/36104693Elsewhere such commas can be optional, e.g. in clojure: https://guide.clojure.style/#opt-commas-in-map-literals bayindirh|4 months ago Try parsing this: { foo :"bar" baz :"bak" quux :[ a,b,c,d ] lol :9.7E+42 } Ref: https://www.json.org/json-en.html, but without commas. It's line noise. Commas allow a nice visual anchor. practal|4 months ago Oh, actually that is the syntax I will use for writing abstractions: my-abstr x y z foo: "bar" baz: "bak" "quak" quux: [a, b, c, d] lol: 9.7E+42 I don't think my-abstr x y z, foo: "bar", baz: "bak" "quak", quux: [a, b, c, d], lol: 9.7E+42 would be better. Indentation and/or coloring my-abstr and the labels (foo:, baz:, quux:, lol:) are the right measures here. load replies (2) RedNifre|4 months ago Looks easy to parse to me and you could also remove the commas in the array. { foo: "bar" baz: "bak" quux: [a b c d] lol: 9.7E+42 }
merelysounds|4 months ago This is a popular question, the most common answer I’ve seen is:> Commas exist mostly to help JSON be human-readable. They have no real syntactic purpose as one could make their own notation without the commas and it'd work just fine.https://stackoverflow.com/a/36104693Elsewhere such commas can be optional, e.g. in clojure: https://guide.clojure.style/#opt-commas-in-map-literals
bayindirh|4 months ago Try parsing this: { foo :"bar" baz :"bak" quux :[ a,b,c,d ] lol :9.7E+42 } Ref: https://www.json.org/json-en.html, but without commas. It's line noise. Commas allow a nice visual anchor. practal|4 months ago Oh, actually that is the syntax I will use for writing abstractions: my-abstr x y z foo: "bar" baz: "bak" "quak" quux: [a, b, c, d] lol: 9.7E+42 I don't think my-abstr x y z, foo: "bar", baz: "bak" "quak", quux: [a, b, c, d], lol: 9.7E+42 would be better. Indentation and/or coloring my-abstr and the labels (foo:, baz:, quux:, lol:) are the right measures here. load replies (2) RedNifre|4 months ago Looks easy to parse to me and you could also remove the commas in the array. { foo: "bar" baz: "bak" quux: [a b c d] lol: 9.7E+42 }
practal|4 months ago Oh, actually that is the syntax I will use for writing abstractions: my-abstr x y z foo: "bar" baz: "bak" "quak" quux: [a, b, c, d] lol: 9.7E+42 I don't think my-abstr x y z, foo: "bar", baz: "bak" "quak", quux: [a, b, c, d], lol: 9.7E+42 would be better. Indentation and/or coloring my-abstr and the labels (foo:, baz:, quux:, lol:) are the right measures here. load replies (2)
RedNifre|4 months ago Looks easy to parse to me and you could also remove the commas in the array. { foo: "bar" baz: "bak" quux: [a b c d] lol: 9.7E+42 }
merelysounds|4 months ago
> Commas exist mostly to help JSON be human-readable. They have no real syntactic purpose as one could make their own notation without the commas and it'd work just fine.
https://stackoverflow.com/a/36104693
Elsewhere such commas can be optional, e.g. in clojure: https://guide.clojure.style/#opt-commas-in-map-literals
bayindirh|4 months ago
practal|4 months ago
RedNifre|4 months ago