2 ms·
Can you clarify this? Your first paragraph seemed to contradict your 2nd one -- I think I must have misunderstood you somewhere. I thought paragraph 1 boiled d
by charlieflowers 11y ago
Can you clarify this? Your first paragraph seemed to contradict your 2nd one -- I think I must have misunderstood you somewhere.
I thought paragraph 1 boiled down to: "you shouldn't see any error handling code most places; only at the top."
Then in the 2nd paragraph, I interpret "all is better than almost all" as: "I want to be forced to check all exceptions all the time, not just a few. (Meaning, I want error handling code everywhere)."
Again, not being argumentative. Just asking for clarification.
- wvenable 11y agoThere are 3 options: unchecked exceptions, checked exceptions, and error returns. Exceptions have some advantages and disadvantages; the advantages are what I said above about only needing to write small amount of code. The disadvantages are that it does have some compiled code-size, performance, and language runtime requirements. The nature of Rust sort of precludes it's use of exceptions and instead they have a reasonable error return facility that is a pretty type-safe way of forcing you to handle or propagate errors. Smaller compiled code, not much performance overhead, and it's easy to reason about because it's consistent. Of course, it's also a lot more boilerplate code to write. Checked exceptions, on the other hand, negate the advantages of exceptions and still have all the other disadvantages of exceptions. It's also a lot harder to reason about than Rust's model of just handling all errors manually.