6 ms·
I use YAML for config files, and I think that's what most people use it for. So, I thought this was going to be an argument for using XML for config files, but
by mcdonje 3y ago
I use YAML for config files, and I think that's what most people use it for. So, I thought this was going to be an argument for using XML for config files, but it's just bashing YAML.
YAML is easy to read like TOML or INI, has comments unlike JSON, and has dictionaries unlike TOML or INI. It's not bad.
It's not YAML's fault they didn't quote their numerical strings.
- Tao3300 3y agoI for one appreciated the observation that if you're using XML for something that isn't a document, you're probably doing it wrong. I recall (perhaps inaccurately) seeing that notion somewhere in http://www.catb.org/~esr/writings/taoup/ http://www.catb.org/~esr/writings/taoup/ and it was at once a shock yet seemed so obvious. Might have been in something else esr wrote, but I've always considered that one to be his masterpiece.
- throwawaaarrgh 3y agoYaml is not a configuration format. It is a data serialization format.
- c-cube 3y agoWhy would anyone use it for serialization, when json exists? Yaml is harder to parse and the implementations have a history of security issues because it's so complicated. If you're not writing it by hand why bother at all?
- throwawaaarrgh 3y agoYou haven't read the spec, I take it. Read the spec, compare it to JSON. It should become apparent what features Yaml has that Json does not.
- kelnos 3y agoRegardless of what it was meant for, it's a worse serialization format than it is a configuration format, despite its warts.
- throwawaaarrgh 3y agoIt's a perfectly reasonable serialization format and works fine as such. It does not work well as a configuration format, because humans are not supposed to write it by hand.
- kelnos 3y ago> It's not YAML's fault they didn't quote their numerical strings. Yes, it is. If you design a format in such a way that type parsing is ambiguous, or in this case "keep trying to parse it over and over, starting with the most restrictive option and working your way down", people are going to commit errors. That's just life. I would absolutely love it if YAML parsers supported a mode where quoting your strings was required. Or, while I'm wishing: a new YAML version that requires that (even though that's impossible to do backward-compatibly without yucky things like having to specify the YAML version in the document itself). But I do still use YAML for config files, because there's enough about the other options that I don't like even more than YAML.
- mcdonje 3y agoReplying to my own comment. Just read through the TOML spec for the first time in years and its tables are essentially dictionaries. Don't know if that was added later or if I just missed it earlier. I'll consider using TOML for future projects. That said, I still think some of the hate YAML gets is unwarranted.