3 ms·
That'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. Wh
by samatman 6y ago
That'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.