|
|
|
|
|
by aseipp
3490 days ago
|
|
The language isn't Turing complete, and it offers no way to encode general recursion in any form (and it isn't offered by the 'compiler' as a primitive). The language is "strongly normalizing", meaning every term and program can always be reduced to a final "normal form", where no more reductions are possible (like how '2' is the normal form of '1+1') and this normal form exists for every program which can type-check. Therefore, the 'compiler' always terminates as well, when it is asked to evaluate the program. You don't even need to get to the point of talking about the halting problem, because the tool isn't asking if any particular program terminates. It does not need to. All programs that can be expressed in the language, by design, terminate. 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.
[0] https://news.ycombinator.com/item?id=4795542