TOML [Tom's Obvious Minimal Language]
10 points by wanderer2323 4 months ago | 12 comments- b4ckup 4 months agoI tried to use toml in as config format for the app I am building at my day job. I ditched it for json because it's representation is not unambiguous, meaning the same object tree has many many different valid representations in toml. This makes it really hard to implement roundtripping of the config string to object tree and then back to config string without losing the specific toml representation chosen by the config author and no library that I've encountered supports it properly. For me this was a very important use case (config migrations). I implemented my own json parser that preserves json formatting and comments in half a day. Maybe json is harder to read and write but imo it's simplicity is a good feature.
- ciupicri 4 months agoI think you meant JSON5 since JSON doesn't have comments.
- krapp 4 months agoDouglas Crockford himself recommended using comments if you like then piping it through JSMin. Unfortunately the original post on Google+ no longer exists but it's referenced in a HN thread[0].
Which of course doesn't help because you could still just add parsing directives into the comments anyway. But as far as I'm concerned that means the spec implicitly allows comments as long as they're stripped out in transport.I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn’t. Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.
- ciupicri 4 months agoIt doesn't matter that if he allowed comments initially if the final (current) specification didn't allow them.
- ciupicri 4 months ago
- b4ckup 4 months agoWell since it's my own parser I support both inline and line ending comments. So I guess it's technically jsonc (json with comments) but whatever really.
Clarification: when speaking of json formatting I handle 2 distinct cases that make sense for me: inline objects and inline arrays (where all properties/ elements are on the same line) which make Configs more readable when the objects / arrays are small.
- krapp 4 months ago
- ciupicri 4 months ago
- gnabgib 4 months agoPopular in:
2023 (165 points, 221 comments) https://news.ycombinator.com/item?id=36018817
2020 (146 points, 160 comments) https://news.ycombinator.com/item?id=24436550
2018 (358 points, 195 comments) https://news.ycombinator.com/item?id=17513770
- LorenDB 4 months agoRequired reading for anybody considering using TOML for something: https://github.com/madmurphy/libconfini/wiki/An-INI-critique...
- motorest 4 months agoThis critique starts off with little to no credibility, with statements such as this:
> Although it claims to be a human-friendly language, TOML constitutes a step back into something more robotic and primitive when compared to INI files and libconfini's approach.
INI files are a complete, utter mess to the point it's even hard to argue they exist as a specified format. TOML's value proposition is specifying a INI-like language.
The critique is an exercise in myopic nitpicking, and confuses specification with implementation. The doc even whines because strings and numbers are different types. Go figure. The whole document is a textbook example of "not even wrong'. A waste if time.
By the way, TOML is supported as the config language of tools such as Rust's Cargo and Cloudflare's Wrangler. It's funny how things actually work in the real world in spite of these documents.
- misnome 4 months agoI don’t think toml is by any means a perfect format but that critique seems almost farcical and self-contradictory in many of its’ complaints. It seems to explicitly want all of the ambiguity and confusion that we’ve spent decades repeatedly failing to learn again and again.
I am not sure it isn’t a well-written parody of a rant.
- nickm12 4 months agoI agree that this is probably a parody, but maybe it's the ravings of someone not right in the head. As a parody, it's not laugh out loud funny, but well-done in the sense that it sits on the border of believably.
- cirwin 4 months agoThis inspired me to write https://conl.dev
I agree with his premise that TOML is not user friendly, but INI is not useful enough. CONL attempts to land in the gap
- motorest 4 months ago
- AstroJetson 4 months agoI still like using Lua as my .ini file data source. I can use a wide range of inputs from numbers to tables. Parsing the file is easy, and getting it into another program is less work that trying to add a parser.