Live data from Hacker News

TOML: Tom's Obvious Minimal Language

toml.io

41–50 of 229 posts

Re: TOML: Tom's Obvious Minimal Language

#41
post #38
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

Multi-line strings are another weakness. Sometimes you don’t\nwant\nto\nwrite\nthis\nway.

I thought the triple quotes let you avoid that, but I assumed, I haven't checked.

Re: TOML: Tom's Obvious Minimal Language

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

Re: TOML: Tom's Obvious Minimal Language

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

Re: TOML: Tom's Obvious Minimal Language

#44
post #16
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

That's already fixed; in the upcoming TOML 1.1 you can write: tbl = { hello = "world", } All the examples in the issue you linked should work. https://github.com/toml-lang/toml/pull/904

published data standards having version is so wrong.

now if you see "config in yaml" you know nothing, zero, nada, about the format because all versions are so different and everyone implemented the version at the time and didn't bother to mention version. not to mention you can use a dozen syntaxes for yaml/toml and each application may not understand them all.

all this is so silly. we will stick with json and informal-ini forever one way or another.

Re: TOML: Tom's Obvious Minimal Language

#46
TOML is nice as a kind of extended .ini format but I don't like the approach to avoiding nested elements.

I prefer KDL. It's like XML but with almost zero syntax. Probably not always the best idea because it's so niche but it's just really simple while having all the basics like comments and multiline strings.

Re: TOML: Tom's Obvious Minimal Language

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

That sounds more like a problem with deserializing configuration instead of parsing.

Re: TOML: Tom's Obvious Minimal Language

#48

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…

I strongly dislike the idea of optional {} on the root object. It’s weird special-casing that adds complexity (code and cognitive) for no adequate reason, destroying the neat contextless recursion of parsing. Remember also that objects aren’t the only valid JSON values; and why should objects be privileged over, say, arrays? You could make [] optional too without introducing actual grammatical ambiguity, other than deciding what to do about the empty string (which “optional {} on the root object” would make valid, unless you special-case it further). But all of these cases require that humans and computers alike look ahead, rather than seeing { and immediately knowing what they’re dealing with.

Re: TOML: Tom's Obvious Minimal Language

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

Are you talking about https://github.com/toml-lang/toml/pull/904 which is merged for 1.1, or something else?

Re: TOML: Tom's Obvious Minimal Language

#50
post #36
post #26

Earlier quoted context omitted.

I moved some config files from json to yaml. Maintaining the documentation became a lot easier, because before I had a document describing every config option, which I had to maintain separately, instead now I have comments in the config file itself.

Note that now you have "the Norway problem" instead. https://hitchdev.com/strictyaml/why/implicit-typing-removed/ There's a whole spectrum of config formats including JSON, JSON5, strict YAML, YAML. It's quite messy.

I found yaml to be surprisingly complex and tricky to write for how simple it looks.

It is made to be beautiful and easy for a human to read, but the trade-off are a lot of implicit rules you need to be aware of.

Post reply on HN