4 ms·
The point of static typing is that the compiler does checks before your program even starts. And that avoids to write lot of coverage tests that are needed (but
by dolmen 3y ago
The point of static typing is that the compiler does checks before your program even starts. And that avoids to write lot of coverage tests that are needed (but usually just ignored) with languages that massively use loosely typed data containers (variables).
- pfdietz 3y agoSure, if you're going to be in an environment where the code is going to be bad because of inadequate testing (and I admit this is quite common, due to the cost of the testing needed), static typing lets it be somewhat less bad. It's just important to understand it's a band-aid, not a panacea.
- marcosdumay 3y agoTesting is a bandaid that only pretends to show that your code is correct. Static verification (what includes static types) is the real deal. That said, WTF is there with people insisting that types must be either static or dynamic, and that dynamic types are useless?
- pfdietz 3y agoStatic typing, as done in mainstream languages, doesn't show your program is correct. Is you compiler written in a mainstream language correct just because it compiles? Of course not. Don't point to academic curiosities with dependent types if they aren't actually used. Extensive testing, on the other hand, is used in the "real world" for assurance.
- yakshaving_jgt 3y agoThis is the classic "Uncle Bob" style false dichotomy. Whoever said you can only pick one of the two approaches?
- marcosdumay 3y agoEvery code out there on the real world is full of baindaids and duct tape. Yet, the actual amount varies a lot, as does the centrality of the patched things.