3 ms·
Calling exceptions "Go envy" or a "mistake" seems like naive criticism. Ignoring the fact that the Rust is as old as Go; there is a lot of time spent in buildin
by nemothekid 5y ago
Calling exceptions "Go envy" or a "mistake" seems like naive criticism. Ignoring the fact that the Rust is as old as Go; there is a lot of time spent in building language features with an, from my point of view, academic level of rigor.
There have been a lot of RFCs discussing exceptions in Rust[1][2][3], and the tradeoffs and design have been discussed thoroughly. If you have a design in mind that is safe, robust and performant you are welcome to submit one - as my understanding is the Rust team does not have an ideological slant against exceptions.
I've never understood the hard-on by some C++ fanboys to rush exceptions. You can build (IMO) more reasonable code without abusing ~~gotos~~ exceptions, and a bad exception design (like Java's) is strictly worse than even Go's error handling.
[1] https://github.com/rust-lang/rfcs/pull/243 https://github.com/rust-lang/rfcs/pull/243
[2] https://github.com/glaebhoerl/rust-notes/blob/268266e8fbbbfd91098d3bea784098e918b42322/my_rfcs/Exceptions.txt https://github.com/glaebhoerl/rust-notes/blob/268266e8fbbbfd...
[3] https://github.com/rust-lang/rfcs/blob/master/text/0243-trait-based-exception-handling.md https://github.com/rust-lang/rfcs/blob/master/text/0243-trai...
- kevinmgranger 5y agoBesides, Result types with sufficiently advanced ergonomics might as well be semantically identical to exceptions.
- pjmlp 5y agoThe so called "Java design" as urban myth, traces back to CLU, Mesa/Cedar, Modula-2+, Modula-3, and C++. Naturally the Java designers thought to adopt a feature that was increasingly being made available. And they only got out of C++ due to the language dialects out there regarding RTTI and exceptions.