← Back to context

Comment by pie_flavor

1 day ago

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.)

> 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.

  • Plugins and IPC do not replace configuration, though configuration may invoke or enable plugins.

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

  • It doesn't need embedding. But if it did, cpython is trivial to embed, and beats starlark in that it already has all the features your users (and Claude) know about.