Hacker News new | ask | show | jobs
by mitchellgoffpc 1690 days ago
The lisp folks are probably wondering why it took us so long to figure out the whole “all configuration is code” thing haha
2 comments

The Tcl folks are also wondering the same thing...

A "configuration file" is simply a valid script that is executed in a safe interpreter.

I know there was a vogue to pretend otherwise but there are definitely benefits to not letting your config file execute arbitrary code.
What do you mean by “arbitrary”? If you don’t want it to access the network or whatever, that’s definitely possible. If you don’t want it to be able to loop forever, though, Turing-incomplete languages like Dhall exist, but that doesn’t stop them from expressing “loop for a trillion years” — but you can always say “we’ll execute this config file for a second and then halt with an error if it isn’t already done”. (You can also pipe an infinite stream into a FIFO and trick your program even if it uses a dumb config language.)
The problem with turing-complete config languages, is not that it might take long to evaluate them. The problem is they are hard to modify by programs. A purely data-driven configuration, e.g. an ini-style config file, json, or xml is relatively easy to parse, transform and unparse again. Doing that with a config file written in a Turing-complete language is substantially harder, theoretically even impossible. But in practice most configuration are evaluated from a subset of all programs. A language like Dhall tries to formalize that subset and and thereby enables better processing of such programs.