4 ms·
>If a certain piece of software is working well, what is the benefit of rewriting it in Rust? The "working" C program has a high risk of undiscovered bugs rela
by _dain_ 2y ago
>If a certain piece of software is working well, what is the benefit of rewriting it in Rust?
The "working" C program has a high risk of undiscovered bugs relating to concurrency and memory safety. Rust lets you rule out a large swathe of them by construction. Rust's type system is also far more expressive, which in many cases enables cleaner domain modelling.
- jvanderbot 2y agoYou're correct that this is the stated justification most of the time. Should be nuanced though, because the working C program has a risk, but the the risk is a function of the size of the codebase, its age, and the number of audits it has undergone. It is definitely easier to write bugs in C due to the additional freedom you have, but it is not necessarily a "high" risk for mature C libraries. It is definitely not as advisable to just replace all C with Rust, but it is advisable to prefer memory safety in new projects.
- _dain_ 2y agoDefinitely. Once you aren't adding new features, the only thing left to do is fix bugs. New rewrites can make the same old mistakes. But there is the potential to have a lower "bug floor" in a safer language.