YAML: Probably not so great after all
121–130 of 457 posts
Re: YAML: Probably not so great after all
#122So what's the HN consensus on the best format for config files? Is it TOML as the author seems to prefer at the end?
The biggest problem with config formats is they mislead users into thinking they understand the format. The user tries to edit it by hand, and chaos ensues. So only formats that are stupidly simple, or whose warts are already familiar and well documented, are good choices.
Apache had a great configuration format. Nothing else used it (that I knew of) but you could in theory implement "Apache configs" and then people'd just have to look up how to write those, which there's lots of examples of.
JSON and YAML and XML are data formats; they should only be written by machines, and read by humans. Same with protocols like HTTP, Telnet, FTP... You're not supposed to write it yourself, but it's readable to make troubleshooting easier.
Data formats are nice for expressing nested data structures, but then they don't (usually) support logical expressions; at that point you need a template/macro/programming language, and at that point you're writing code, which will need to be tested, and at that point you should just write modules and use a config format to give them arguments. Every complex tool goes through the same evolution.
If you care about your users, write a tool to generate configs based on a wizard. Good CLI tools do this, and it really makes life better. (It's also a great way to document all your config features in code, and test them)
Re: YAML: Probably not so great after all
#123Earlier quoted context omitted.
Would you say actual YAML does a better job in Ansible over just writing JSON and letting it be parsed as YAML?
I can at least write comments in YAML.
Re: YAML: Probably not so great after all
#124So what's the HN consensus on the best format for config files? Is it TOML as the author seems to prefer at the end?
Re: YAML: Probably not so great after all
#125Function application was disabled some time ago, and `yaml.load()` logs a noisy deprecation warning telling users to use `yaml.safe_load()` instead [1].
[1]: https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-...
Re: YAML: Probably not so great after all
#126As an ansible user, I hate YAML and its broken parsers with a passion, but the security objection does not make much sense. It does apply verbatim to any parser of anything if the implementation decides that a given label means "eval this content right away". I fail to see how this can be a fault of the DDL rather than the parser's.
Re: YAML: Probably not so great after all
#127Re: YAML: Probably not so great after all
#128fish shell is looking for a new text serialization format for its history file (currently it uses an ad-hoc broken psuedo-YAML). Boxes to check: 1. Self describing format 2. SAX-style parser available to C++ 3. Easy for users to understand and ad-hoc parse using command-line tools 4. No document closing necessary, so appending is trivial YAML looks pretty good: - cmd: git checkout file.txt when: 1565133286 pwd: /home…
Re: YAML: Probably not so great after all
#129So what's the HN consensus on the best format for config files? Is it TOML as the author seems to prefer at the end?
Re: YAML: Probably not so great after all
#1302. Format is declared to have x and y problem, new format is invented that is "simpler and better"
Time passes
3. People slowly discover format in #2 has the same issues that led to creating #1.
Repeat.
(Just like attempting to super-generalize anything else)