3 ms·
> the person I'm replying to is [making that claim] Er, no. I certainly wasn't, and the person you were replying to above that was making the opposite claim:
by mpweiher 3y ago
> the person I'm replying to is [making that claim]
Er, no. I certainly wasn't, and the person you were replying to above that was making the opposite claim: that it's harder than that.
And no, the type system doesn't really help all that much, once you have unit tests. Because unlike the unit tests, which checks values (and obviously the types as well, incidentally) the type system only checks the types.
So, trivially, if you mix up addition and subtraction, your unit tests will rightfully balk, whereas your type system is going to be "works for me".
As I wrote elsewhere in this thread, in my personal experience the type system was happy during a large refactor long before the unit tests were. Which means that there was a lot of stuff that the type system missed.
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.
- Chabsff 3y agoTo 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.