by ReflectedImage · 3y ago · 0 comments
Programmers write bugs per line, something like Python which only uses 33% of the lines and thus contains only around 33% of the bugs. On the other hand, if you go down the prove things are correct at compile time you will eliminate around 5% of the bugs.
So you can choice between eliminating 67% of the bugs by making the language simpler to use or 5% of the bugs by doing formal checking.
At no point was the memory of my program ever replaced with the number 53 nor did memory become corrupt due to multiple threads accessing the same areas at the same time. Much better than C++.
Did my Rust project suddenly contain no errors or did it never crash? Well no. How did it crash?
Array indexing (called default instead of new which created an invalid version of the struct)
Infinite loop (logic error causing it to add the result each loop to the input vector rather than the output vector).
That said Rust is almost certainly going to kill C++. It's a lot better.
Rust removes types of errors that can happen. Logic errors don't belong to the types of errors Rust 'removes'
Source?
Hack more code into one line -> less bugs for the overall program? doubt
Use Typescript instead of JS (thus add a few loc) -> more bugs? certainly doubt
One source would be: https://www.oreilly.com/library/view/code-complete-2nd/07356...