3 ms·
I hate this sort of article. Lots of griping about the problems with YAML, but no solutions. What does the author think is better? XML doesn't map to the same d
by skywhopper 6y ago
I hate this sort of article. Lots of griping about the problems with YAML, but no solutions. What does the author think is better? XML doesn't map to the same data structures as YAML, JSON, and TOML, so it's not really a comparable beast.
The author mentions a desire to be able to teach a data format to people in the way someone can comprehend HTML or Markdown easily. But the formats have different goals.
The goal of HTML and Markdown are to provide a way to encode document formatting in a simple text syntax. There's not one single correct way to format a document intended for presentation to and consumption by humans. Pretty much anything goes, HTML and Markdown just provide some decoration.
But the purpose of YAML (and JSON and TOML) is to provide a way to represent strictly defined data structures for consumption by a computer. The reason YAML is frustrating is because you can't fudge the result; you can't be sloppy or inexact; YAML operates at the boundary between the human and the computer program, and just like any HCI, it's going to be frustrating and error-prone.
Now, would it be possible to come up with a better format than YAML or JSON or TOML that does the same thing? Maybe. But the facts that tools exist to search and manipulate these formats and that we'll probably still be using them in 2030 isn't evidence that they are bad. The fact that yq can exist and is useful is a point in favor of YAML, imo. If simple tools can be written to do useful things with a data format, that makes the format more useful.
- t-writescode 6y agoHow do you mean? They're all interchangeable. If you treat XML attributes as @-prefixed variables in the set of json nodes and visa-versa, they're fully compatible.