I feel like the safety that Rust offers is balanced out by the complexity it introduces. I don't understand why anyone would rewrite in Rust to try and get rid of bugs. You never get a more reliable product after this process.
I feel like the safety that Rust offers is balanced out by the complexity it introduces. I don't understand why anyone would rewrite in Rust to try and get rid of bugs. You never get a more reliable product after this process.
Check out slides from this talk: https://www.usenix.org/conference/enigma2021/presentation/pa...
At some point you have to admit that the language is the problem. Eliminating entire classes of bugs by construction is much more effective than testing for them.
For example, sum types prevent most cases of unexpected nulls and uses of returned values without error checking.
Languages can't eliminate all bugs, but the more they can prevent, the more you can focus on testing the rest.
I just mean to say that the idea that you inherently make your software more reliable by "rewriting in Rust" is false. I don't contend that it could have benifits but I think to some extent you swap one set of problems for another and maybe in a language you don't understand as well as the one you're coming from.
It's not some Ying/Yang balance of force or a contract with the devil where getting rid of sneaky Undefined Behaviors must be paid for with another evil.
In C I've struggled with multi-threaded software, and even relatively tame solutions like OpenMP ended biting me. OTOH I haven't had to debug a data race in Rust yet (I've caused a bunch of deadlocks, but these are relatively easy). In C, despite my best efforts, I've occasionally had buffer overflows, leaks, and UAFs. In Rust I've had these only when interacting with C libraries via FFI.
You could probably say that my C bugs were my fault, and I'm just not a good C programmer. Well, I haven't got any smarter, but I'm a good Rust programmer.
Hard work and testing do not solve all problems. There is a certain amount of inherent complexity in system-level and high performance application development that is not guaranteed to disappear through hard work and testing alone.
>> I feel like the safety that Rust offers is balanced out by the complexity it introduces.
Rust is merely exposing the complexity that is inherent to system-level and high performance application development. The same problem exists whether you use C, C++, Rust, or other programming languages that target system-level and high performance applications.
The difference is that Rust points out the problems instead of the C / C++ approach of "the developer knows what they are doing".
C is obviously not as complex, but it that is because it offers so much less. Depending on what is needed, C may be a great choice, but it generally means bringing or creating a bunch of library code for string-handling, data structures, etc.
This is how you build pyramids.
If you want to build something taller and in 1% of the time, you relegate most of the work to machines.