2 ms·
> “Finite time” isn’t much of a guarantee. A million years is finite. You are technically right, but in practice, finite time does help a lot. To quote from t
by eru 3y ago
> “Finite time” isn’t much of a guarantee. A million years is finite.
You are technically right, but in practice, finite time does help a lot. To quote from the Dhall documentation at https://docs.dhall-lang.org/discussions/Safety-guarantees.html#turing-completeness https://docs.dhall-lang.org/discussions/Safety-guarantees.ht...
> Note that a “finite amount of time” can still be very long. For example, there are some short pathological programs that take longer than the heat death of the universe to evaluate. The main benefit of evaluation being finite is not to eliminate long-running programs but to make them significantly less probable. In practice, you will discover that you will rarely author a configuration file that takes a long time to evaluate by accident.
> It should be easier to make complex, long-running calculations safely cancellable.
Just send kill 9 to your program, if you want to cancel it? That seems like an entirely separate topic? (Especially if your calculation is pure, it's always safe to cancel it.)
- skybrian 3y agoYes, killing the process is how cancellation of a batch job is normally done, for example in shell scripts. But it’s a heavyweight approach. Backend servers don’t use a process per request anymore and they do need ways to cancel a request. Go’s Context API handles cancellation and timeouts at the request level, but it has to be coded manually; a badly-behaved goroutine could still leak and consume resources long after it’s cancelled. So it might be nice to have automatic support at the language level, to make guaranteed cancellation happen by default. This is the approach taken with structured concurrency. To preserve the invariant that a child task doesn’t outlive the parent, there needs to be a way to kill any unneeded child tasks when a function returns early. Totality checks seem like a poor substitute when what you actually want is to prevent resource leaks. I haven’t used Dhall, but it seems like a config language has different concerns?