Live data from Hacker News

TOML: Tom's Obvious Minimal Language

toml.io

71–80 of 229 posts

Re: TOML: Tom's Obvious Minimal Language

#72

I pretty like the idea of a superset of JSON that supports (1) comments, (2) trailing commas, (3) unquoted properties, (4) optional {} for the root object, (5) multi-line strings, (6) number separator. JSON6 proposal [1] supports all of this, except (4). Unfortunately it also supports more and make the spec a bit too complex for my taste (JSON has a compact spec; any extension should honor this). Same issue with JSON…

Let me introduce you to our lord and savior: YAML. ;)

Ah yes, the language where a string can magically become a boolean and cause an error. And you can never be sure what is legal because of so many changes in parsing legality between versions.

Yaml is one of the worst config languages.

Re: TOML: Tom's Obvious Minimal Language

#73
post #63
post #10

JSON is basically perfect if it allowed trailing commas and comments. TOML is not a replacement for JSON because of how badly it chokes on nested lists of objects (being both hard to read and hard to write), due to a misguided attempt to avoid becoming JSON-like[1]. [1] https://github.com/toml-lang/toml/issues/516

> JSON is basically perfect Until you realize you can't actually store real integers because every number in js is a float...

You can store the first 2^53 integers with either sign, and if you need accurate integer values beyond that size you can stringify them and parse as big ints.

It’s not ideal, but 2^64 integers is also finite.

Re: TOML: Tom's Obvious Minimal Language

#74
post #42

Funny thing: TOML author/inventor calls it a mistake: > TOML is a bad file format. It looks good at first glance, and for really really trivial things it is probably good. But once I started using it and the configuration schema became more complex, I found the syntax ugly and hard to read. > I personally abandoned TOML and as such, I'm not planning on adding any new features > If you're still reading, I'd like to pu…

Someone called Martin is the "author/inventor" of "Tom's Obvious Minimal Language"?

It might be “Tom OR Martin's Language”.

Re: TOML: Tom's Obvious Minimal Language

#75
post #63
post #10

JSON is basically perfect if it allowed trailing commas and comments. TOML is not a replacement for JSON because of how badly it chokes on nested lists of objects (being both hard to read and hard to write), due to a misguided attempt to avoid becoming JSON-like[1]. [1] https://github.com/toml-lang/toml/issues/516

> JSON is basically perfect Until you realize you can't actually store real integers because every number in js is a float...

JSON allows you to store arbitrarily large integers/floats. It's only in JS this is a problem, not if you use JSON in languages that support larger (than 54-bit) integers.

Re: TOML: Tom's Obvious Minimal Language

#76

Earlier quoted context omitted.

Let me introduce you to our lord and savior: YAML. ;)

Ah yes, the language where a string can magically become a boolean and cause an error. And you can never be sure what is legal because of so many changes in parsing legality between versions. Yaml is one of the worst config languages.

YAML is great except for everything wrong with it, YAML is the worst except for all the others, etc., etc.

Re: TOML: Tom's Obvious Minimal Language

#77
post #63
post #10

JSON is basically perfect if it allowed trailing commas and comments. TOML is not a replacement for JSON because of how badly it chokes on nested lists of objects (being both hard to read and hard to write), due to a misguided attempt to avoid becoming JSON-like[1]. [1] https://github.com/toml-lang/toml/issues/516

> JSON is basically perfect Until you realize you can't actually store real integers because every number in js is a float...

You can store arbitrary precision numbers in JSON. The spec explicitly doesn't lock you into floats or any other specific number format.

Re: TOML: Tom's Obvious Minimal Language

#78
post #43
post #10

JSON is basically perfect if it allowed trailing commas and comments. TOML is not a replacement for JSON because of how badly it chokes on nested lists of objects (being both hard to read and hard to write), due to a misguided attempt to avoid becoming JSON-like[1]. [1] https://github.com/toml-lang/toml/issues/516

The problem with comments in configuration files is that they don't survive a `load -> native object -> save` round-trip.

I played around with "format preserving" edits of a few text formats, including nested formats (a JSON inside a TOML inside a YAML etc)

https://github.com/mkmik/knot8

Re: TOML: Tom's Obvious Minimal Language

#79
post #10

JSON is basically perfect if it allowed trailing commas and comments. TOML is not a replacement for JSON because of how badly it chokes on nested lists of objects (being both hard to read and hard to write), due to a misguided attempt to avoid becoming JSON-like[1]. [1] https://github.com/toml-lang/toml/issues/516

If you parse JSON as YAML you can add comments! YAML is a proper superset of JSON.

Not really. https://stackoverflow.com/questions/21584985/what-valid-json...

Re: TOML: Tom's Obvious Minimal Language

#80
post #75
post #63

Earlier quoted context omitted.

> JSON is basically perfect Until you realize you can't actually store real integers because every number in js is a float...

JSON allows you to store arbitrarily large integers/floats. It's only in JS this is a problem, not if you use JSON in languages that support larger (than 54-bit) integers.

That's the freedom of unspecified behavior.
Post reply on HN