This is a fairly low bar for correctness, and not really one I would really agree with :/
This is a fairly low bar for correctness, and not really one I would really agree with :/
The same logic can be applied in Java or C++ or probably even C, but it also comes down to the wide spread and idiomatic approaches of the language. The rust eco system is not necessarily coherent around the details of errors, but error handling is generally rigorous. The benefits of that can’t be overstated. The compiler is a huge help in getting it right in a way that Java checked exceptions never was.
I’m sure that there are other languages that are showing similar wins, though. I haven’t written much Swift, but I imagine that the experience might be similar?
I am no fan of rust and actually hate its evangelism. But this is ridiculous.
Deleting the production database is a thornier philosophical question, but Rust's position is that it is.
In Rust I feel like almost every time the program works on the first time it compiles successfully, even without writing tests. Probably a combination of very well designed API, builtin RAII, very explicit syntax, compiler strictness and clear docs. I also cannot forget to handle errors (even if I just decide to propagate or crash).
This is what "correctness" means to me, but it isn't exactly enforced by the compiler itself.
No language/tool/etc will stop all programmer mistakes, but they can definitely stop some.