17 ms·
YAML is a data serialization format that was never intended to be written by hand. It was intended to be written by programs serializing their data, and read by
by throwawaaarrgh 3y ago
YAML is a data serialization format that was never intended to be written by hand. It was intended to be written by programs serializing their data, and read by a human.
This is the reason so many people don't like YAML. They don't know how to use it right, and they keep fucking it up, getting pissed off, and not learning their lesson.
Don't write YAML by hand and it works fine. And maybe read the spec...
While we're on the subject - Did you know you don't have to pick from 3 existing formats? You are allowed to make your own new configuration formats. And you are allowed to make them not be some perfect universal solution for all configuration needs for all programs.
Back in the day, every program invented its own configuration format, with features designed just for what that one program needed to do. They were ugly and not based on any kind of "principles" or "best practice" or trendy bullshit found on a social media site for nerds. It was just whatever the user found easiest that worked. No standards, just a wonky configuration that worked great for that one program. And guess what? All those weird formats, they are still around today, because the programs are still around, because they are useful and work.
Get off of HN and make something unique that you find useful. Don't ask people on here if it's good, just use it. If it works for you, it's good enough.
- ojkelly 3y agoBut YAML _looks_ like it’s easy to write by hand. It looks easier than JSON to write by hand. JSON at least makes it known that you’ll have a better time generating it, that writing it. It’s like those doors that open by pushing them. Some open both ways, some have a handle to grab and open it to you, some have a plate for you to push on. And some (like YAML) have a plate on the side you need to pull, and a handle on the side you need to push.
- deleted 3y ago[deleted]
- ianburrell 3y agoYAML was always intended to be written by hand. It was originally an alternative to XML for "markup language" although it isn't one. It was used for serialization, but JSON quickly won in that realm. But YAML was used for configuration files from the start. A good example is the quoting of strings, that wouldn't be optional in serialization language.
- throwawaaarrgh 3y ago> YAML was always intended to be written by hand. No, it was intended to be an alternative to XML. But it was the renamed to YAML Ain't a Markup Language, because it's really intended to be used for data, not human-centric markup. YAML uses hard data typing, and types are inferred (though can be explicit). When a program serializes data, it does not add the explicit types. Therefore for a human to edit the file, they would need to have the entire YAML parser semantics in their brain, or add the explicit types, and hope the YAML parser they are using will re-serialize the explicit types (most are poorly implemented and won't). Therefore it is virtually impossible for a human to write YAML correctly by hand. Its only reliable use is as a data language for programs to serialize data. It just happens to be easy to read.