4 ms·
Small nit but Rust's panic is not an exception mechanism: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html https://doc.rust-lang.org/std/panic/fn.catch
by vvanders 10y ago
Small nit but Rust's panic is not an exception mechanism:
https://doc.rust-lang.org/std/panic/fn.catch_unwind.html https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
Particularly you may not be able to catch all panics. Result<T,E> is the canonical way to handle errors in Rust.
Also in gamedev(where this looks like this comes from) we generally avoid RTTI(for size reasons) and STL(for allocation control reasons, see EASTL, etc).
- Animats 10y agoFor both Go and Rust, it's not supposed to be exception handling. But both languages have acquired proper unwinding, so people can and do use it that way. The original idea in Go was that if you caught a panic, the program was in a bad state, and all you should do is report the problem and maybe restart the program. Like "longjmp" in C. Now, people are doing recovery without re-launching the program. That's effectively exception handling.