Hacker News new | past | comments | ask | show | jobs | submit login

Problem is... YAML sucks, as human readable format



No it doesn’t. I know the HN-crowd feeling about this, but no, YML doesn’t suck as a human configuration language. TOML or XML properly suck. YML is actually a superset of JSON with comments and less brackets if you want. It’s widespread and supported and fulfill the need of OP, so no need to add yet another format. Or use JSON5. But please not yet another standard


YAML is one of the worst formats I've ever encountered due to its mind-boggling complexity.

There's a ton of ways to represent booleans, a ton of ways to represent dates, a ton of ways to represent numbers of a ton of different bases, a ton of ways to represent strings of various line-endingness'. It really has caused a significant number of easily avoidable issues in my experience.


How is TOML bad as a config language? I would not transmit data in TOML but is makes a lot of sense as a config language.


Neither YAML or TOML are config languages, they are data formats.

A data format is a way of structuring or serializing data. The whole point of the format is to read and write arbitrary data. It may have a simple schema, or features designed for the loading and unloading of data. But all those features are designed to assist the machine, not the human operator.

A config format is designed specifically to assist a human operator, not a program. Humans should not have to consider data types when they write a config, or when they feed it to a program. Humans should have useful features to make their lives easier, like variable substitution, pattern matching, inheritance, namespaces, simple newline-separated whitespace-indifferent commands, etc.

Programming languages are just elaborate configuration formats. And that's where the problem begins: how much "power" do you give the configuration format before it gets unruly? It's difficult to find a balance. People end up using simple data formats because the parsers are widely available and they can "fake" advanced features by making programs interpret a specifically-crafted data structure as a configuration instruction. But there's very little thought put into how this can be extended to make more complex configurations easier.

Most web servers and other complex software [usually run by sysadmins] have a real configuration format or configuration language. Poorly-written software pretends a data format is a programming language, or even worse, forces you to use an actual programming language. These designers fundamentally don't understand or don't care about the user.


Why do you think TOML sucks for configuration files? I use it everywhere and it has been a joy so far. Granted, I only used it with Go, but it has been a great experience, and the configuration files are nice. For configuration files I would rather use TOML than JSON. For other stuff? I would probably go with ASN.1!


How complex is your configuration? I've used TOML for Traefik config[1] and I've found there's so much repetition.

The single/double square bracket thing is also non-obvious at first.

[1] https://doc.traefik.io/traefik/routing/routers/


As a human-readable configuration language, YAML probably beats JSON and XML, but the implicit typing rules in the spec make it horrible to work with. I've written a lot of YAML for Ansible and it has some awful footguns.


YAML is fine as a user. It can be just JSON without some of its visual clutter if you like brackets, or much more concise if you prefer.

All the complexity related to anchors and such is unfortunate, but that’s a problem for parser writers.


> YAML is fine as a user

The link in the main article convinced me otherwise: https://noyaml.com/




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: