Live data from Hacker News

YAML document from hell (2023)

ruudvanasseldonk.com

61–70 of 144 posts

Re: YAML document from hell (2023)

#61
post #59
post #6

The n, no, off thing is just sad. It's a 100% avoidable issue. But whoever put that into spec was just so clever that they overflew and became stupid.

Whoever thought supporting sexagesimal numbers was a good idea needs to spend some extended time away from their computer to reflect on what they’ve done

We wanted a file format that's easy to read and less verbose than xml and all we got was something that is so full of pitfalls that it would be easier just not to use it.

Re: YAML document from hell (2023)

#62
post #33
post #22

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

It's because other config formats aren't as expressive.

See starlark, dall, jsonnet, cuelang, toml, etc.

Re: YAML document from hell (2023)

#64

The Norway problem drives me a bit nuts. In a lot of the Ansible documentation, yes/no are used instead of true/false. When seeing this in the official docs, I used it, figuring this was the preferred convention in Ansible. These days it now throws warnings or lint errors, so I’m updating it all over the places as I find it. Yet the Ansible documentation still commonly uses it.

Ansible isn't a gold standard for docs. The docs are updated and maintained, but the underlying interfaces aren't consistent and that leaks to the docs. One can only wonder why, maybe different developers with different ideas for conventions without a style guide. Ansible is a wonderful tool though, if you can excuse these idiosyncrasies.

> Ansible is a wonderful tool though, if you can excuse these idiosyncrasies.

The only advantage Ansible has is how easy it is to start with it - you don't need to deploy agents or even understand a lot about how it works.

Trouble is, it doesn't really scale. It's pretty slow when running against a bunch of machines, and large configurations get unwieldily quickly (be it because of YAML when in large documents its impossible to orient/know what is where/at what level, or because of the structure of playbooks vs roles vs whatever, or because templating a whitespace-as-logic-"language" is just hell). It's also fun to debug "missing X at line A, but the error can be somewhere else". Cool, thanks for the tip.

So it's pretty great to get started with, or at a home lab. Big organisations struggling with it is a bit weird.

Re: YAML document from hell (2023)

#65
post #52

IMO, JSON, YAML, and TOML should all interpret all keys as strings, and only enforce quotes when syntactically necessary. So, `key1` is a string and doesn't need to be quoted. `12345` as a key is interpreted as a string (because keys are strings) and doesn't need to be quoted. `"key 1"` has a space, so it needs to be quoted.

What does IMO configuration look like

Re: YAML document from hell (2023)

#66
I came to regard YAML as a kind of a syntactic HFC syrup, a bearable idea that was taken too far.

Alas, YAML is just about everywhere, so the chances for a replacement that'll be both better behaved and as ubiquitous are unfortunately slim.

Re: YAML document from hell (2023)

#67
post #64

Earlier quoted context omitted.

Ansible isn't a gold standard for docs. The docs are updated and maintained, but the underlying interfaces aren't consistent and that leaks to the docs. One can only wonder why, maybe different developers with different ideas for conventions without a style guide. Ansible is a wonderful tool though, if you can excuse these idiosyncrasies.

> Ansible is a wonderful tool though, if you can excuse these idiosyncrasies. The only advantage Ansible has is how easy it is to start with it - you don't need to deploy agents or even understand a lot about how it works. Trouble is, it doesn't really scale. It's pretty slow when running against a bunch of machines, and large configurations get unwieldily quickly (be it because of YAML when in large documents its im…

Seems like the right answer is "bootstrap your daemon installs with Ansible and then use something that scales better that runs on those daemons."

What are the best practices along these lines? What's the "something better"?

Re: YAML document from hell (2023)

#69
post #19

We found yaml to be a great exchange format for electronic exam data. It allows us to put student submitted answers and source code into a yaml file and there is no weird escaping. It's very readable with a text editor. And then we just add notes and a score as a list below and then there's the next submission. For readability of large blocks of texts that may or may not contain various special characters and newline…

Somebody in these discussions always correctly points out that s-expressions are as expressive as XML but without the excess line noise, so it might as well be me.

Re: YAML document from hell (2023)

#70
post #56
post #52

IMO, JSON, YAML, and TOML should all interpret all keys as strings, and only enforce quotes when syntactically necessary. So, `key1` is a string and doesn't need to be quoted. `12345` as a key is interpreted as a string (because keys are strings) and doesn't need to be quoted. `"key 1"` has a space, so it needs to be quoted.

We'd have to change the spec and then all the core libs. Big task. Use more quotes, use yamllint. Like bash, more quotes and shellcheck.

Specs change from time to time. It requires effort. Nothing new here. It's necessary sometimes. Dealing with annoyances and footguns also takes effort.
Post reply on HN