4 ms·
I find it remarkable that YAML has become our goto for configuration when it is riddled with parsing traps and inconsistent behaviour that catches out even expe
by aranw 1y ago
I find it remarkable that YAML has become our goto for configuration when it is riddled with parsing traps and inconsistent behaviour that catches out even experienced developers
- mcdonje 1y agoIt's because other config formats aren't as expressive.
- foobarian 1y agoAnd furthermore I find it remarkable how much people like the visual format where you indent nested things with whitespace. I'm pretty sure it's the main reason Python took off as well.
- nucleardog 1y agoIt's the least-annoying option in a lot of cases. JSON is for computers. Writing and editing by hand is not great. Escaping things sucks. A simple multi line string or something gets really awkward. XML goes too far the other way... it's annoyingly verbose to write by hand. Escaping can get annoying. It often allows you to represent data structures that are not easily representable in various languages. INI sucks because it lacks a specification. It also sucks for nested data. TOML fixes this by essentially specifying a better INI file. Much like an INI file, this falls apart at any real level of nesting. EverythingElse is not widely supported. When it comes to basic configs and stuff humans need to work with, I usually start with a basic K=V format. Writing a "parser" in any language usually takes about one minute and has no dependencies so is an easy win. As soon as a use case grows beyond that (quoting, explicit typing, multiple lines, escapes, whatever) I just move to YAML. It's not the best, but it's easily available and the least bad from my point of view.
- array_key_first 1y agoUnironically PHP arrays are the perfect config format. Nestable like JSON, terser, no parsing traps, typed. I mean, this is just great: ```php [ 'driver' => 'mysql' 'options' => [...], ]; ``` Obviously not a lot of support though... Its PHP.