5 ms·
The borrow checker is one of Rust’s selling main selling points, and was what got me into the language. If you don’t see the value of compile-time memory safet
by Cyph0n 6y ago
The borrow checker is one of Rust’s selling main selling points, and was what got me into the language.
If you don’t see the value of compile-time memory safety in Rust, you probably haven’t spent hours debugging subtle runtime memory safety errors in a large C application.
- otabdeveloper4 6y agoRead my post again, please. The people who choose Rust over C++ aren't (generally speaking, there are of course exceptions) doing because of the borrow checker. They're doing because Rust has Cargo and C++ doesn't.
- steveklabnik 6y agoI think it is extremely hard to generalize here.
- ncmncm 6y agoThis, anyway, is correct: In 30 years of coding maximal-performance C and C++ systems, I have not spent hours debugging subtle runtime memory safety errors. I have spent strictly more time tracking down compiler bugs. I can count on one hand the memory errors I have debugged in five years. The longest took a half-hour. (Code that used a "relaxed" atomic load was moved to a place where it needed "acquire" -- which is the default.) So, I eagerly prefer (rounding up) 2.5 hours of debugging spent in five years over spending 5 extra hours every week -- 1750 hours in 5 years -- waiting on builds from a very slow compiler. (I don't know any reason why the Rust compiler could not be two orders of magnitude faster, and notably faster than a C++ compiler.) My experience may be unusual in that I do not habitually depend on code badly-written by other people. My complaints about other people's code I do use are more typically about performance, conformability to requirements, or poor usability.
- Cyph0n 6y agoI haven't been writing C for anywhere as long as you have, but I have definitely spent quite a bit of time printf() debugging and digging through corefiles in GDB. I also have never had to deal with compiler bugs, but that could be because IOS-XR uses a stable/old compiler toolchain. I could be wrong, but I would wager that you are definitely an outlier among C and C++ developers. For the remaining majority, I believe that the compile-time memory safety guarantees that Rust provides are huge. As to why your experience is different, it could be that you're simply (1) a talented programmer, (2) work with talented programmers, or (3) don't work on a large and complex legacy codebase, or some combination of the above.