|
|
|
|
|
by anon-3988
226 days ago
|
|
With the ? syntax in Rust results and exceptions are the same thing. I posit that the former is superior. It is unfortunate that results have worse performance but I don't see any reason why. Results that bubbles up all the way ought to be identical to an uncaught exception. |
|
This also means that exceptions can have stacktraces that only incur a cost on the unhappy path and even only if that exception is uncaught. While if you want a trace for a bad Result you are going to be doing a lot of extra book-keeping that will be thrown away
In general I agree that Results are the better abstraction, but there are sadly some tradeoffs that seem to be hard to overcome.