3 ms·
I've spent a lot of time now writing code in both Haskell and Elixir. Where I have found that static typing really shines is when you do large scale refactoring
by jeremyjh 7y ago
I've spent a lot of time now writing code in both Haskell and Elixir. Where I have found that static typing really shines is when you do large scale refactoring. Especially in a large code base it is much, much faster to fix compiler errors after refactoring, than to run the tests and figure out why each one is failing. In Haskell by the time my tests all compile after a refactor, they are already passing.
- dgreensp 7y agoYup. In a codebase without static types, large-scale refactors are probably just not practical, which may be why fans of dynamic types don't have this problem; they can't, and thus don't, do substantial refactors without rewriting.
- z3t4 7y agoThe trick is to write the code so that one piece of code does not affect another piece of code. You can write static code in a dynamic language by making all functions pure functions eg. no side effects.
- z3t4 7y agoThere are also static analysis tools for JavaScript. For example Google closure compiler. Which can infer about 80% of all types.