Re:Bugs that the Rust compiler catches for you
by Georgelemental on Friday May 06, 2022 @12:48PM
(#31287292)
IO errors like running out of disk space would be handled by returning a `Result` type, not by panicking. Often, Rust code/libraries panic on out-of-memory errors because recovering from that isn't a priority for most application code. But if you are writing lower-level or high-reliability code and you do want to handle out-of-memory errors, the Rust standard library (and many third-party libraries) offer alternative fallible memory allocation APIs that return `Result` instead of panicking on out-of-memory.
Re:Bugs that the Rust compiler catches for you
by notriddle on Friday May 06, 2022 @12:45PM
(#31287257)
I disagree.
A good developer will crash the program, as soon as possible, if and only if it has a bug. If you want to write a program that never crashes, then you need to write a program with no bugs.
The reason you don’t want buggy code to limp along after it detects a bug, is that crashing isn’t the worst possible thing.
The worst possible thing is getting stuck in an infinite loop or a deadlock.
There are always bugs(logic bugs where Rust can't protect you) so why not have a clean interface?