3 ms·
> And why not have the most basic conditional take the role of that syntax? Because having approx. 3/4 of your code devoted to error handling and error propaga
by thayne 4y ago
> And why not have the most basic conditional take the role of that syntax?
Because having approx. 3/4 of your code devoted to error handling and error propagation is both hard to write and hard to read.
IMO rust's approach is close to ideal, in the common case where you just propagate up, the syntax is succinct, but still explicit, and when you handle it, the logic is close to the callsite, and is just working with a normal value.
Useful stack traces are still a bit of a problem, but there is work being done on that.
And that's not to mention how in go you always return both the error and regular values, even though you usually only use one.