|
|
|
|
|
by maxk42
543 days ago
|
|
There's a critical difference between exceptions and what's happening in this article: exceptions create de facto nondeterministic behavior in programs. They cause every line in a function to potentially result in a return from the function with an unexpected type. Rust's error handling requires explicit return statements and explicit return types. This critical difference results in code that is far easier to document, reason about, and slightly better performance as well. |
|
And exceptions don't have to be slower than putting errors in return values.
(Having said that, I am still not a proponent of exceptions for error handling.)