logoalt Hacker News

pie_flavoryesterday at 6:13 PM2 repliesview on HN

It is good to keep a configuration simple enough that it doesn't need to be a programming language.

The absolute moment you find yourself thinking of putting conditional logic, or string substitution, or anything like that, in your pure config format, switch to a real programming language, before you end up managing several times the complexity of one with only some of the benefits. No need to end up contemplating some sort of for-loop macro with another key referencing the loop variable, when you can just have a for loop.

I find TOML, in addition to being very readable, to be great at automatically restricting config complexity by making nested lists of tables miserable. If your config sucks at being TOML, it should be JS or Python. (Not a fan of Lua.)


Replies

skydhashyesterday at 9:28 PM

> The absolute moment you find yourself thinking of putting conditional logic, or string substitution, or anything like that, in your pure config format, switch to a real programming language, before you end up managing several times the complexity of one with only some of the benefits

That’s where you add a plugin system or an ipc mechanism, not a whole programming language.

show 1 reply
crowdyriveryesterday at 7:04 PM

python is terrible for embedding, starlark is the way to go. Very easy to embed.

show 1 reply