5 ms·
It is so easy to complain about something, but seriously: what are the alternatives for human readable config files?
by karussell 7y ago
It is so easy to complain about something, but seriously: what are the alternatives for human readable config files?
- m4r35n357 7y agoFor a scripting language, how about the language itself?
- eyelidlessness 7y agoThis is what I do whenever possible. And bonus if your scripting language is statically typed. My projects use TypeScript configurations, with the `config` import statically typed and each configuration file checked against those types. It's a great way to ensure you don't miss a config change for an environment you're not working on at the time.
- baq 7y agoTuring complete configuration is a no-no.
- williamdclt 7y agoMany reasons to prefer a static declarative config over a dynamic imperative one. Sometimes the latter makes more sense, but there is very much a need for the niche YAML tries to fill
- gruez 7y agosubmission about exactly that: https://news.ycombinator.com/item?id=22787332 https://news.ycombinator.com/item?id=22787332
- Kaze404 7y agoDoesn't the article go over that?
- karussell 7y agoWhere? I only see in "conclusions" that StrictYAML is recommended, but this is only about the implementation not the format itself. TOML is mentioned but I do not see wide adoption, e.g. no up-to-date Java or similar implementation. (https://github.com/toml-lang/toml/wiki#implementations https://github.com/toml-lang/toml/wiki#implementations) Additionally I think TOML is more verbose compared to YAML but avoids the indentation ugliness.
- hocuspocus 7y agoIf you're in the Java world, HOCON is pretty neat. https://github.com/lightbend/config https://github.com/lightbend/config
- cyphar 7y agoI really like TOML. It's very similar to old-school INI files except it has a standard and parsers in quite a few languages. It does has its own downsides (while the concept of tables is quite useful, it can be a bit tricky to understand when you first see it). But it's one of the least-bad "modern" configuration formats I've seen.
- vsajip 7y agoIn 2008, before many of the options for configuration that are available now had been created, I came up with a hierarchical configuration language [0] to use in my Python code. More recently, I had a look at some of the newer options available (JSON5, HJSON, HOCON, SANE and TOML), but still find them wanting in various ways. The latest iteration of my take on it [1] is now available in multiple environments (Python, the JVM, .NET, Go, Rust, D and JavaScript). I would welcome any critique from the HN community. [0] https://wiki.python.org/moin/HierConfig https://wiki.python.org/moin/HierConfig [1] https://docs.red-dove.com/cfg/index.html https://docs.red-dove.com/cfg/index.html
- bspammer 7y agoJSON is perfectly readable in my opinion.
- sooheon 7y agoEDN is great. https://github.com/edn-format/edn https://github.com/edn-format/edn