5 ms·
I wish people stopped using YAML. It is a terrible, ambiguous, error-prone data format, particularly not suitable for data exchange purposes.
by atemerev 4y ago
I wish people stopped using YAML. It is a terrible, ambiguous, error-prone data format, particularly not suitable for data exchange purposes.
- jwr 4y agoIt's also terribly unintuitive, despite trying to be "simple and obvious". A really bad choice.
- andai 4y agoI just looked it up, looks like YAML no longer parses Norway's country code as a boolean (NO). Not sure how widespread YAML 1.2 adoption is though. https://github.com/crdoconnor/strictyaml/issues/186 https://github.com/crdoconnor/strictyaml/issues/186
- aaron695 4y agoAfter dealing with the absolute garbage that is XML I was always happy to see JSON. I agree YAML is bad and would say JSON is the best we have. What are you suggesting? I think you have to make call if you say something is terrible or a bad choice.
- zozbot234 4y agoJSON is a subset of YAML anyway. So anything that accepts YAML can deal with JSON, and you can convert one to the other.
- krapp 4y ago>JSON is a subset of YAML anyway. It isn't, really. A conforming YAML parser will not treat JSON data the same way that a JSON parser will in all cases. [0,1] The only correct way to deal with JSON is using a JSON parser. [0]https://john-millikin.com/json-is-not-a-yaml-subset https://john-millikin.com/json-is-not-a-yaml-subset [1]https://news.ycombinator.com/item?id=31406473 https://news.ycombinator.com/item?id=31406473
- nerdponx 4y agoIs the "%YAML 1.2" directive necessary? Seems like something that you should be able to turn on in a YAML parsing library.
- moffkalast 4y agoWait, can pyyaml actually parse json? I highly doubt it.
- atemerev 4y agoXML is a fine markup language for anything that looks like a document, but a very poor configuration format. JSON is a great text-based exchange format and protocol medium, but extremely poor configuration language (no comments, no references, very restricted syntax for human editing). Every tool has it uses (for configuration purposes I suggest something like HOCON, or even some superset of INI, like Python’s configparser). YAML is bad at everything.
- nerdponx 4y agoYAML is fine at deeply-nested configs (where TOML kind of falls over), support for multi-line strings in a variety of formats is nice, and the ability to use references and anchors makes it good for things like defining a schema with reusable components. Mistakes were of course made with the "friendly" booleans (yes/no unquoted strings). The Docker Compose and OpenAPI formats, are good uses of YAML that would be cumbersome in any other format. Is HOCON better? Maybe. As far as I recall it doesn't have any affordance for multi-line strings, which I see as a valuable YAML feature. It does have its own merits, though, and is probability a better default than YAML in a lot of projects. But at least if you want an INI-like format, use TOML instead of an ad-hoc underspecified alternative.
- kzrdude 4y agoYaml has comments and the sensible subset of yaml is in my opinion a good format compared with all alternatives
- nerdponx 4y agoAlso, most of the problems of YAML go away if you defensively quote strings.
- cozzyd 4y agoI am a fan of the libconfig format: https://hyperrealm.github.io/libconfig/ https://hyperrealm.github.io/libconfig/ (it's quite close to json, but supports comments and also integer sizes and such)