4 ms·
Even though you probably just picked some language design aspects as random examples... Rust doesn't have recoverable exceptions. It has fancy error codes. It
by ahartmetz 7y ago
Even though you probably just picked some language design aspects as random examples...
Rust doesn't have recoverable exceptions. It has fancy error codes. It is also quite low level in the same spirit as C++: only pay for what you use, and what you use should not be possible to write more efficiently by hand.
- cesarb 7y ago> Rust doesn't have recoverable exceptions. Playing devil's advocate: when compiled with panic=unwind, it has. However, the fact that when compiled with panic=abort they turn into unrecoverable exceptions tends to make the "should it throw exceptions or should it use error codes" choice clear.
- epage 7y agoWe're talking use cases. In Rust, you'd use Result where in C++ you would use exceptions. Panic is equivalent to assert and should not be used where you'd use exceptions in other languages.
- pjmlp 7y agoC++23 might get value type exceptions, and the design is even being discussed across ISO C working group, so that will eventually change.