3 ms·
The benefits are not the same. Code can type check but not be correct. There's no free lunch. Some languages require explicit type definitions others don't.
by igouy 1y ago
The benefits are not the same. Code can type check but not be correct.
There's no free lunch. Some languages require explicit type definitions others don't.
- theLiminator 1y ago> Code can type check but not be correct. Depends on your type system. It can prove the correctness of certain properties depending on your language. Conversely, unit tests can pass but your code might not be correct.
- igouy 1y agoDepends on your type system. Depends on your tests. Depends. Yet another under-specified commentary ;-)
- kibwen 1y agoConversely, code can pass tests and not be correct, including in ways that would have been trivially caught by a type system. If you care about correctness, use both. Codebases written in static languages still use tests.
- deleted 1y ago[deleted]
- parpfish 1y agoWell, yeah. Types don’t remove the need for ALL tests, but it removes the need for the most boring 90% so your test suite can just focus on the most important behaviors