▲ | jlarocco 4 days ago | |||||||||||||||||||||||||||||||||||||||||||||||||
> I need to sit down and manually exercise codepaths Isn't that exactly what unit tests are for? | ||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | pansa2 4 days ago | parent | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||
Yeah, that's a common argument for dynamic typing. You're writing tests anyway (right?), and those will catch type errors and many other kinds of error. Why bother with a separate level of checking just for type errors? I personally believe it's a valid argument (others will disagree). IMO the main benefit of static types isn't for correctness (nor performance) - it's to force programmers to write a minimal level of documentation, and to support IDE features such as autocomplete and red underlines. Hence the popularity of Python type hints and TypeScript, which provide these features but don't fully prove correctness nor provide any performance benefit. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | mkehrt 4 days ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||||||||||||||
Fortunately my compiler writes a large number of unit tests for me, that run at compile time! I call it the "typechecker". | ||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | airstrike 4 days ago | parent | prev [-] | |||||||||||||||||||||||||||||||||||||||||||||||||
Except now you're writing and maintaining twice the amount of code instead of relying on the compiler and/or type checker to help you catch those errors | ||||||||||||||||||||||||||||||||||||||||||||||||||
|