4 ms·
I don't recall single a production bug in my code caused by a type issue (excluding null/undefined cases, where typing is rarely helpful), whereas I've lost cou
by ergothus 10y ago
I don't recall single a production bug in my code caused by a type issue (excluding null/undefined cases, where typing is rarely helpful), whereas I've lost countless hours to teaching a compiler what it should already know. (And I have plenty of bugs, they just tend to be logical rather than type based).
That said, I also try to use a lot of unit tests, so there HAVE been more than a few pre-prod issues having to do with types. I just view the time spent on these as still less than what a strictly-typed language would require. Fixing the 1 in a 100 situation that is quickly exposed in a test is less effort than being verbose 100 times.
I will admit that there are some test cases that typing would make much easier - but not enough to yet sway me. I'll also say that strong typing (ala Python) is far less painful to me than static typing (ala Java).
I'll try to keep an open mind, but until I start seeing production bugs that make it worth more development pain, it's unlikely to occur.
* I'll also note that I think my web experience makes me prefer coercion, because everything has to keep switch to/from strings. Though I'm sure the strict-typing crowd will see that as evidence that typing has all the more need to be enforced :)
- sa1 10y agoDealing with null and undefined cases is a significant practical advantage of a modern type-system. Compilers can catch most of them. Also you can encode your logic in types - The Curry-Howard Correspondence (https://en.wikipedia.org/wiki/Curry–Howard_correspondence https://en.wikipedia.org/wiki/Curry–Howard_correspondence) says this is always possible in sufficiently advanced type-systems. While this goal hasn't been realized in mainstream programming languages, we have been moving towards it for a long time. So when you say that you only have logical errors, not type errors and can't recall any type issues, do keep in mind that those are exactly the kind of things type-systems aim to solve. But I can't blame you since Java and similar languages provide the only mainstream experience of static types.