3 ms·
> Without types … Now try to find all the places that you broke. Do failing tests show what we broke?
by igouy 1y ago
> Without types … Now try to find all the places that you broke.
Do failing tests show what we broke?
- bpshaver 1y agoSometimes, but maybe you haven't written any tests! Type hints and immediate feedback from mypy are a lot easier than writing unit tests.
- igouy 1y ago> haven't written any Any! Then maybe the immediate feedback of consistent types conveys a false impression.
- bpshaver 1y agoHard to conceive of a case where that would occur. Can you think of one? The implication of what you're saying seems to be that if you're concerned about some kind of correctness you should be writing unit tests anyway and not being so fussed about type checking in a language like Python. I suppose if you are strictly following TDD that might work, but in all other cases type checks give you feedback much more quickly than unit tests ever can. I guess I don't understand.
- igouy 1y agoAny old math with consistent types and incorrect calculation? (If only we'd diff'd the output with some known result.) No doubt we're at cross purposes. I'm a little surprised that you haven't mentioned — "Program testing can be used to show the presence of bugs, but never to show their absence!" (or existential versus universal quantification).
- bpshaver 1y agoI'm afraid you lost me.
- AnimalMuppet 1y agoYes, if you have tests that test all aspects of the behavior for all possible inputs. Oh, you don't have that? Then do not scorn the help you can get from types.
- igouy 1y ago"Less than 35 bugs were found in the 17,100 changes." https://news.ycombinator.com/item?id=42473314 https://news.ycombinator.com/item?id=42473314 I wonder how many were not found.