4 ms·
To address the unit test stuff: I'm not saying that type systems replace unit tests. I'm saying that unit testing in dynamically typed languages is fundamentall
by Chabsff 3y ago
To address the unit test stuff: I'm not saying that type systems replace unit tests. I'm saying that unit testing in dynamically typed languages is fundamentally deficient.
Or in other words: unit tests are made more reliable by type systems.
Unit tests can only check outputs for the inputs that are provided during testing. Leaving the input unbounded means that they can only provide guarantees for code that conforms to the tested subset of inputs.
I may be able to test that `foo(3) == 4` and foo("foo") == "bar", but since I can't guarantee that `foo({})`, or literally anything else, will never be called, there will always be holes in the safety net they provide. This is something type systems directly address.
> And so if you feel your type system is going to make your refactors safe, well, good luck to you and the poor people who have to use your code.
safer. It makes them safer, not automatically safe.