The fixes for these are both fairly well known (always quote strings and keys, use safe_load or an equivalent API), but it's very easy to make a mistake.
TOML, by contrast, is much simpler - strings are strings are strings, they must always be quoted but other than that behave pretty much as expected. Similarly, there is no mechanism by which a TOML file can instruct the parser to execute arbitrary code as part of deserialisation, which makes it (a) a lot simpler, and (b) a lot safer.
In particular, the plethora of boolean values... here let me just grab the regex from the spec [1]:
y|Y|yes|Yes|YES|n|N|no|No|NO
|true|True|TRUE|false|False|FALSE
|on|On|ON|off|Off|OFF
At that point why limit yourself to just the English language?Then there's the language-specific types or, as YAML calls them, "local tags". The stuff preceded by `!` like
!!map {
? !<tag:yaml.org,2002:str> "foo"
: !<!bar> "baz"
}
At that point, you've exceeded the scope of "human-readable".I'll admit there are some other, er, "complications" that I actually like. In particular, anchors (`&FOO`) and aliases/references (`*FOO`) [2] make it possible to describe arbitrary graphs, and I find it very useful to factorizing blocks. Also, "folding" [3] text, which allows you to spread value/text across multiple lines for readability, while respecting the surrounding indentation, is neat.
[1] https://yaml.org/type/bool.html
Language tags can get weird but they're ultimately just additional types implemented by your yaml parser you should basically always turn off/not turn on unless you know you want it. You can serialize classes in your language without it.
Tags are really good for readability if you use them thoughtfully
value: !!binary
base64string
# ordered map
value: !!omap
a: 123
b: 455
The reason that example is so ugly is it's using the "complex mapping key" syntax which is unbelievably ugly but if you're using objects as keys in your map you abandoned sanity long ago.This was fixed in YAML 1.2, but the problem is that almost nobody uses (and there is patchy support for) it.
I don't mind TOML but I don't find it either intuitive or obvious. The syntax for how nested things are flattened I just find really hard to read and write. It's fine though, not that big a deal.