3 ms·
> What if you have a long-running operation? If you return an error value when that operation happens, but it turns out the nature of the operation allows you t
by zozbot234 5y ago
> What if you have a long-running operation? If you return an error value when that operation happens, but it turns out the nature of the operation allows you to ignore that error and continue, you'll have to re-start the entire computation.
This is just as much of a problem with exceptions. "Fix the error and continue" needs some equivalent to resumable conditions, which are generally implemented at the "low level" using coroutines. My understanding is that async-await as a language feature might be able to express these with relative ease, but exceptions alone clearly do not suffice.
- throw10920 5y agoI didn't actually say the word "exceptions" anywhere in my comment. That's because I agree that exceptions are not enough - but the solution that is enough, namely conditions and restarts, also requires "ambient control flow" to use the language of the parent. I was arguing for that and against return values, not for exceptions.