4 ms·
> Safe Rust looks absolutely painful painful compared to other safe languages. It really isn't. It's quite nice to use. The big hangup is that Rust "wants" you
by stouset 2y ago
> Safe Rust looks absolutely painful painful compared to other safe languages.
It really isn't. It's quite nice to use. The big hangup is that Rust "wants" you to structure your programs according to a certain philosophy. Unfortunately the compiler can't teach you that approach directly, but can only complain when you write programs that don't abide by it.
In my experience, following this design philosophy benefits even outside of memory safety, and I now write code following these principles in every language.
> Correct C is not actually hard to write.
Quite literally all of the available evidence strongly disagrees with this conclusion.
> Correctness is more than just memory safety and avoiding overflows. They are still bugs in programs and languages that avoid those problems.
This is true, but C lack tools to help with any of them. Fixing memory safety and overflows is in and of itself an enormous win, but Rust also has other tools that assist in program correctness (sum types being a huge one).
- kazinator 2y ago> Quite literally all of the available evidence strongly disagrees with this conclusion. Easy to write is not the same thing as easy to prove. It may be hard to show that some C program is correct, but when that is done, that doesn't change that it was easy to write (if that had been the case). C is actually "unreasonably effective". You can't just look at the problems; the overall picture is that a lot of large and complicated, yet well-working systems have been achieved in C. They may not be correct, but are "correct enough".
- stouset 2y agoThe number of large C programs which have been repeatedly proven to be incorrect in practice is essentially 100%. Still, C is unreasonably effective. A lot of large and complicated, yet mostly well-working (modulo regular CVEs) systems have been achieved in C. And that’s truly wonderful. I cut my teeth on C nearly 30 years ago and I still hold a soft spot in my heart for it. But other languages these days are even more unreasonably effective. They need fewer lines of code to achieve the same results and they have fewer security vulnerabilities and logic bugs per line as well.
- kazinator 2y agoMany of the ways that C programs are incorrect are abstract portability problems, that don't have a repro test case on the machines and compilers that people care about. Rule of thumb: almost never fix some alleged problem without a repro test case.
- stouset 2y agoMight I point you at the CVE database?
- kazinator 2y agoMay I point you to Wikipedia pages on cognitive biases, like Confirmation and Selection? The CVE database lists only entries related to situations gone wrong. It doesn't list any information about working software that has no issues. Also nothing will appear in the CVE database in relation to a language that nobody uses. The database also has some garbage entries. Overall the database is actually paltry in size in relation to the vast amounts of stuff out there written in C. Also, correct C programs can have security issues, because some security issues depend on actual behaviors being observable which correspond to behavior that is not observable according to language standard. ISO C is mum about memory being observed, or side channel information being monitored, or timing of operations.