Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hm.

I can see where the article is coming from. Some configuration files grow beyond classical configuration and end up being more like programming. With configuration being "Put the right connection / path strings into the program, enable some subsystems/feature toggles" and programming being along the lines of, e.g., arbitrary metric transformations in a metric collector, or programmable ACLs. With some systems, I very much end up wondering why I couldn't just load lua into the system and do the transformations with that.

However, configs in json/toml/yaml come with a lot of tooling. With a custom configuration language, you suddenly need to roll your own syntax highlighting in many editors, maybe linters, pretty-printers, ... Your config can't just be computed by a configuration management system and deployed via `computedConfig | toJSON`, instead it'll be necessary to wrangle templating. And users generally know those languages.

And writing parsers is a pain. And generating parsers is also a pain. And using bad parsers is also a pain. I've worked too much on parsers.

Those are some pretty big hurdles to overcome and if you don't, the user experience just starts off worse.



yaml (and json) gives configuration files much-needed hierarchy and structure, which is unbounded (within reason), not limited syntactically or inherently like simpler configuration formats including toml.

yaml adds to that comments and a pleasant readable layout, even if it requires a little bit more from the editor to make it pretty.

With that, I don't think yaml has much competition.


Hm, again. I don't think I agree it's that clearcut.

I've found that if you mostly want a tree of simple key-value assignments, such as database.postgres.user or database.mysql.timezone, TOML is actually very hard to beat. It's extremely simple to teach to less technical coworkers. TOML mostly becomes somewhat strange if you need lists, or maps with free-form keys.

Also, YAML is horrible if you have to generate it. Pretty much everyone automating stuff I've met will prefer JSON over YAML once you need to automatically generate the configuration. Pushing some data structure through an as-yaml pretty printer usually works, until it breaks in really weird incompatibilities between YAML parsers. And that happens way too much to be a fun distraction.


Toml has unlimited nesting as well.

There are also many formats that are "better json" that have comments, multiline strings, trailing commas etc. Such as hjson, json5 (and variants such as json6, jsonX, etc.) and hocon. As well as more sophisticated languages like jsonnet, dhal, and cue.

Many of these can be "compiled" to JSON.

There is plenty of competition, but for some reason, YAML seems to be the most popular.


TOML gets very weird as soon as you have more than one level of nesting.


Nesting multiple levels of tables is pretty simple, you just have sections that look like [a.b.c]. It's different than Json, but IMO easier to read and navigate.

Unfortunately it doesn't handle c arrays of arrays of tables very well.


It depends on the kind of nesting, cargo has multiple levels of nesting all the time and it's working well.

Through is you have thinks like object->list->object->list thinks can get weird without questions.

Still most time I had such complex configs I also often (not always) realized that I did something wrong and unnecessary complex...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: