Re:“Rust is safe” is not some kind of absolute guarantee of ...
by layer8 on Sunday October 02, 2022 @12:45PM
(#33057642)
By exceptions, I’m referring to languages with exceptions as a dedicated language construct with automatic stack unwinding, and preferably without UB (e.g. Java or C#). Rust doesn’t have exceptions in that sense.
[ Parent
| on HN ]
Re:“Rust is safe” is not some kind of absolute guarantee of ...
by dureuill on Sunday October 02, 2022 @01:58PM
(#33058468)
But panics in rust are pretty much exceptions though?
The differences are they are actually meant to be used for exceptional situations ("assert violated => there's a bug in this program" or "out of memory, catastrophic runtime situation") and they are not typed (rather, the panic holds a type erased payload).
Other than that, it performs unwinding without UB, and is catchable[0]. I'm not seeing the technical difference?
[0]: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
Re:“Rust is safe” is not some kind of absolute guarantee of ...
by layer8 on Sunday October 02, 2022 @02:13PM
(#33058621)
You’re probably right now that I’ve read up on it, I wasn’t previously aware of catch_unwind.
Re:“Rust is safe” is not some kind of absolute guarantee of ...
by dureuill on Sunday October 02, 2022 @02:18PM
(#33058676)
Glad to be of service. Note that the idiomatic error handling in rust is still Result based rather than panic/catch_unwind based.
Nevertheless a long living application like, e.g., a webserver will catch panics coming from its subtasks (e.g., its request handlers) via catch_unwind