Make your own invariants expressed as types' template parameters and assert runs during monomorphization. This isn't an academic example, I do this in real projects. These fancy languages don't monomorphize and that is why you can't get nice things in them.
Rust does monomorphization so maybe I don't get what you're saying there.
Anyway type systems are not expressive enough to encode all sophisticated invariants.
And we don't have time to write proofs, do we? Yet as users, we'd like OpenSSL and OpenSSH to be formally proved, it's immensely expensive to do so.
Compiler warnings make this irrelevant. Same with floating/integral conversions and between floating types.
There we disagree a bit. I think this should be in the standard. Of course everybody would be crying. Lots of people are crying all the time because "warnings get in their way" (and I hate them. Edit: the people, not the warnings).
Edit: if you're doing code that is cross clang, gcc, msvc and armcc, the warnings are somewhat different. So one more argument for them to be standard, IMO.
Most of the time the bugs I make are high-level architectural errors or single-procedure logic errors. Memory-related stuff is barely ever a problem. There are tools for that anyway.
Yes, I keep hearing this. Then I do code reviews, for production code, sometimes (but rarely) security code.
And industry-wide numbers suggest otherwise.
Memory errors and parallelism errors happen a lot in the wild. So I disagree again
I don't know what tools you're referring to, but Valgrind and sanitizers are not usable/practical in lots of embedded environments, for instance, especially with realtime contraints.
Interesting discussion, though !
I think it all boils down to "trust the implementer" vs "trust the ecosystem". I've written enough bugs to support the second stance !