3 ms·
Another comment brought up StrictYAML, and they have a good dissection of the problems with TOML[1]. Personally, after doing a few pyproject.toml files, I stil
by ben509 6y ago
Another comment brought up StrictYAML, and they have a good dissection of the problems with TOML[1].
Personally, after doing a few pyproject.toml files, I still find it confusing and awkward as soon as you get past simple headers and key-values.
TOML is like YAML, it translates to "jsonic" types, but JSON's virtue is that simple 1:1 mapping between syntax and data.
TOML and YAML both have non-obvious syntax and there's a layer of translation you have to do to understand what you're actually generating.
But I don't really want to generate a big blob of objects, arrays and such, I want to configure something. I think that's why none of these languages work very well.
[1]: https://hitchdev.com/strictyaml/why-not/toml/ https://hitchdev.com/strictyaml/why-not/toml/
- saghm 6y agoIMHO the arguments in your link aren't particularly convincing. The three main points seem to be verbosity (defined in terms of total number of characters for a given file, which is not nearly as important to me as readability), not having indentation be significant (which might be downside to a Python programmer but feels like a win to me), and having explicit syntax to distinguish between types (e.g. strings being quoted, which is preferable to me, since it makes them stand out as values compared to the keys). If these are the strongest arguments against TOML, I find myself fairly convinced that TOML is probably the format I'd like to use most even though I was I different towards it before clicking the link.
- throwaway894345 6y agoI would be very interested in an experiment in which participants are required to write Kubernetes manifests in YAML or TOML, and what the analysis suggests they prefer (after controlling for the right set of variables). I don’t like YAML, but TOML stops being nice very quickly as the size or complexity of the data increases IMO.
- afiori 6y agoThe second point is not about whitespace, but rather about how you can write your document out of order. specifically TOML supports a syntax that allows to write documents like: (not actual syntax) a.b=1 a.c=2 d=3 a.e =4 that would translate to {a:{b:1,c:2,e:4},d:3}. So the criticism is that (in various cases) you need to read the entire document to be sure to have fully parsed one subtree of the document.
- samatman 6y agoThat's not a bad argument against using TOML, and I'm inclined to agree that TOML is more verbose than it has to be for heavily-nested maps-of-maps-of-maps. Which you can pretend is a strength, since I consider doing that an anti-pattern. But it is a valid critique. However, the TOML they offer as a comparison to the StrictYAML is probably auto-generated (they do say "serialized TOML equivalent") and it's quite a bit noisier than it has to be. TOML deliberately has a couple of ways of writing arrays, and a one-line short format for maps: you're supposed to alternate these, and this technique could eliminate most of the repetition in that particular file. I still wouldn't choose TOML for a complex tree of user stories where the keys are all long strings of English: that's an example of the kind of thing where you might talk yourself out of using it! Here's the counterpoint I want to offer: stories of YAML "configuration languages" escaping confinement and becoming headache-inducing repositories of monstrous complexity are practically cliche at this point. Part of why that is, is that you don't pay for that complexity "up front": It's just a nice list! It's easy to read! I would add one thing to TOML if I could: it should default to a string for the value part of a key-value pair, if it can't make anything else. So my_val = 42 Makes a number, my_string = "42" Gives you a string, and my_regex = ^\"(\\.|[^\"])*\" lets you handle regexes without the obnoxious double-quoting problem, while removing a lot of the verbosity and ceremony from the format.
- andreareina 6y ago> TOML deliberately has a couple of ways of writing arrays, and a one-line short format for maps: you're supposed to alternate these, and this technique could eliminate most of the repetition in that particular file. Could you provide an example of what you mean, or point to some such? We're having a spot of trouble with arrays of maps ourselves.
- samatman 6y agoIf you look at https://github.com/toml-lang/toml/blob/master/toml.md https://github.com/toml-lang/toml/blob/master/toml.md, you'll see "Array", "Inline Table", and "Array of Tables", and you can put an inline table inside an array. This breaks down when things get really branchy. TOML really expects keys to be symbols rather than strings.