3 ms·
Right, but what you did not get was undefined behavior. That is the real difference, not that Rust "discourages" unwrap(). unwrap() panics, while unfortunate,
by topspin 9y ago
Right, but what you did not get was undefined behavior. That is the real difference, not that Rust "discourages" unwrap(). unwrap() panics, while unfortunate, are well defined.
- jhasse 9y agoIn reality, this doesn't make a difference though ;)
- topspin 9y agoHalting in a defined manner vs. continuing computation while undefined conditions prevail are fundamentally different outcomes. This is indeed a difference.
- jhasse 9y agoComputation doesn't continue, it segfaults.
- topspin 9y agoYou simply cannot know that and your assertion reveals a lack of understanding. Computation may continue indefinitely, unintentionally distributing your private keys or doing some other heinous thing forever, without any sort of MMU trap. Undefined means undefined, not 'segfault.'
- jhasse 9y agoI said "in reality". Can you give me an (realistic) example where using a nullptr doesn't result in a segfault?