3 ms·
“Any invariant enforced by the type system is guaranteed to be correct throughout your codebase.” Strictly speaking, this is only true of languages with sound
by evincarofautumn 14y ago
“Any invariant enforced by the type system is guaranteed to be correct throughout your codebase.”
Strictly speaking, this is only true of languages with sound type systems. C++ lets me enforce immutability with “const”, yet I can deliberately subvert the type system with “const_cast” if I know better than the compiler, or if I just feel like invoking undefined behaviour today.
“I strongly believe that a reason we're seeing people moving to dynamically typed languages is because the popular statically typed languages have given static typing such a bad name.”
This is my perception as well. Static typing that doesn’t actually give you any guarantees is just a nuisance. And developers are notoriously busy, and lazy—it’s only when you can conveniently apply a tool that you actually will apply it. In that regard, Haskell is excellent: it makes me type without making me type.