6 ms·
YAML seems like a really neat idea, but over time, I have I have come to regard it as being too complicated for me to use for configuration. My personal favori
by RcouF1uZ4gsC 6y ago
YAML seems like a really neat idea, but over time, I have I have come to regard it as being too complicated for me to use for configuration.
My personal favorite is TOML, but I would even prefer plain JSON over YAML
The last thing I want at 2 AM when trying to look figure out if an outage is due to a configuration change is having to think if each line of my configuration is doing the thing I want.
YAML prizes making data look nicely formatted over simplicity or precision. That for me, is not a tradeoff, I am willing to make.
- Arnavion 6y agoThey all have their downsides. JSON: - no comments, unless you fake them with fake properties, unless your configuration has a schema that doesn't allow extra fake properties - no trailing commas; makes editing more annoying - no raw strings YAML: - the automatic type coercion - the many ways to encode strings ( https://yaml-multiline.info/ https://yaml-multiline.info/ ) - the roulette wheel of whether this particular parser is anal about two-space indentation or accepts anything as long as it's used consistently - the roulette wheel of whether this particular parser supports uncommon features like anchors TOML: - runtime footguns in automated serialization ( https://news.ycombinator.com/item?id=24853386 https://news.ycombinator.com/item?id=24853386 ) - hard to represent deeply-nested structures, unless you switch to inline tables which are like JSON but just different enough to be annoying
- perlgeek 6y agoFor hand-writing I love jsonnet, which produces JSON, is much more convenient to write, and has some templating, functions etc. https://jsonnet.org/ https://jsonnet.org/ You wouldn't serialize data structures to jsonnet though, you'd just generate JSON.
- anticristi 6y agoThis makes me sad. It's 2021 and we still haven't figure out how to serialize configuration in a format that is easy-to-edit and predictable.
- trhway 6y agoXML with a convenient UI tools to edit should have fit the bill. Yet, for whatever reason a convenient UI tool would never happen to be there when needed, and thus scared and tired of manual editing of XML the world have embraced YAML.
- masklinn 6y ago> XML with a convenient UI tools to edit should have fit the bill. "You need this special tool to work" immediately and instantly rules out "easy to edit". Or makes the debate irrelevant: every format is easy to edit if you have "a convenient UI" to do it for you.
- anticristi 6y agoOpening XMLs in ZIP containers is easy! Just spin up Word. :)
- sergeykish 6y agoThe fault was in XML editing, pure data authoring is hard. We have convenient UI — web browser, think of it as literate programming, a way to merge man page and configuration file. And plain text editor is a "widely deployed special tool to work". Actual data is countries:\n- GB\n- IE\n- FR\n- DE\n- NO Or 636f 756e 7472 6965 733a 0a2d 2047 420a 2d20 4945 0a2d 2046 520a 2d20 4445 0a2d
- imhoguy 6y agoWe had such: XML. With proper editor support it is easy. I guess it needs rediscovery /s ;)
- anticristi 6y agoI used XML and didn't like it: - A proper editor was never around. - Closing tags were verbose. - Attributes vs tags was confusing. - It didn't map "naturally" to common data types, like lists, maps, integers, float, etc.
- tgv 6y ago> - the automatic type coercion Only when you "unmarshal" to an untyped data structure and then make assumptions about the type. I've used yaml with a go application, and it can't interpret NO as a bool when the field is a string.
- Arnavion 6y agoCorrect, like TFA.