3 ms·
> They break the notion of programming as a sequence of events. It's never been that way. What's a page fault? > No matter how you slice it, exceptions are
by quotemstr 9y ago
> They break the notion of programming as a sequence of events.
It's never been that way. What's a page fault?
> No matter how you slice it, exceptions are still a goto under the covers.
"break" is also a goto. What's your point?
> If they are truly exceptional, you might as well call exit() too.
That's completely unacceptable for robust software. Programs can recover from almost all errors and make forward progress, usually via staging some kind of rollback. Tearing down a whole process in response to error is a ridiculous extreme that works only in a few narrow domains.
> Exceptions are a mistake, plain and simple.
Is that why almost every language ends up adopting them in some way? Even languages that start out vehemently anti-exception, like Go and Rust, end up with the full try-and-catch exception toolkit. That's because, despite protestations, exceptions are extremely useful.
- deleted 9y ago[deleted]
- steveklabnik 9y ago> Even languages that start out vehemently anti-exception, like Go and Rust, end up with the full try-and-catch exception toolkit. Rust (and as far as I know, Go) have pretty much remained the exact same with regards to their implementations here. Go uses panic/recover a bit more liberally than Rust uses panic/catch_panic; using panic for control flow is not idiomatic, and so is not done. Since you can turn them into an abort, it's not something you can rely on when writing a library, and so I'm not aware of any significant libraries that do so. You couldn't even catch panics for a long time, and the possibility was mostly added to prevent UB with regards to extern functions.
- quotemstr 9y agoI find it amusing and sad that the Rust ecosystem, via this "panics as abort" feature, replicated one of the worst parts of the C++ ecosystem: -fno-exceptions, which, in C++, turns throws into aborts. In both language environments, the availability of a compiler option that breaks a language feature doesn't erase the existence of that language feature.
- steveklabnik 9y agoIt doesn’t break the feature, that’s how the feature is designed. They’re not for error handling. It’s only broken if you try to treat them as something other than what they’re designed for.
- chi3 9y agoThat's because a panic should never happen in Rust. If it happens, there's by definition a bug which will make the thread crash.
- RustGirl 9y agoI started out as a rust True Believer and still am active in the Rust community. But I don't use it anymore for new projects because it really doesn't bring anything new to the table. At my current job, I'm knee-deep in C++.
- frankzinger 9y ago> because it really doesn't bring anything new to the table. What about the built-in memory and concurrency safety?