by dozzie · 9y ago · 0 comments
Configuration file should be passive data, not a programming language, and as easy to process in variety of languages as possible.
> Configuration file should be passive data, not a programming language
Some interesting config file formats now represent nested lists. That's enough for S expressions representation.
It's arguable what configuration process does. Especially if it's (safely) not Turing-complete. Setting "passive" values of some parameters in today's configs could lead to quite complex changes in the configured program behavior.
> and as easy to process in variety of languages as possible.
S expressions are parsed in many languages e.g. here - http://rosettacode.org/wiki/S-Expressions . Don't see a problem with processing.
How do you know for certain?
Where's the proof for the Halting Problem in this case?
Claiming safety through termination is nice, but not something that is simple to solve.
But the details are more subtle. In particular you can write a configuration expression that takes 10 years to compute, but it's probably less likely you'll do this. So you also need a way of asking "Is this in normal form" too, for things like explicitly untrusted inputs. But that's pretty doable since you can traverse the input and easily see if any terms haven't been reduced.
I'd need to look into that a bit more, but at the moment I don't believe that is actually true.
Dhall provides anonymous functions, or the basics of lambda calculus.
This probably means that I can encode the Y-Combinator in it, resulting in anonymous recursion, though unless functions are first class, it'd by 500+ LOC.
Again, I haven't reviewed the internals enough to see, but if you have functions, that's normally enough to build infinite anonymous recursion.
Even if it isn't possible for some reason I haven't seen, claiming safety in that fashion probably isn't appropriate.
I'm also not certain that it isn't Turing Complete.
The C Pre-Processor doesn't supply a way to encode general recursion, but as we can see here [0], it is entirely possible, though to a limited depth. Leading to some debate as to whether or not it is Turing Complete.
If a configuration program created by Dhall is not guaranteed to terminate in a timely manner, then you completely lose the safety there.
Reduces to a normal fashion is completely useless as a guarantee if it takes 10 years, and is one of the reasons that simple markup/notation forms like YAML and JSON that are readable in O(1)/O(n) time end up preferred, rather than something that can explode into O(n^2) time.