3 ms·
> I find it hard to believe that static typechecking is not advantageous compared to checking for every returned value whether it's undefined or null or a strin
by omegalulw 5y ago
> I find it hard to believe that static typechecking is not advantageous compared to checking for every returned value whether it's undefined or null or a string instead of the expected array.
+1. A simple way to think of this is that realize that strict type checking significantly reduced the number of possible codepaths, so the cognitive load on you is much smaller making it less likely for you to make mistakes.
With static typing, what you should also practice is using the strictest type possible, e.g., don't use a pointer if null has no meaning for you, don't use a vector if the size of the continer is fixed, etc.