4 ms·
Would a type error necessarily produce a "bug" in a program?
by LearnYouALisp 15y ago
Would a type error necessarily produce a "bug" in a program?
- DanWaterworth 15y agoIt certainly would if it was not detected before the code was deployed. Depending on how strongly typed the language is, it may cause an error at runtime, which isn't ideal, or it would go undetected until it caused a myriad of seemingly unrelated symptoms, which is much worse. Unhandled null references are the most common type error that other languages don't catch as readily (I fairly frequently try to write code that doesn't handle the not found case in a map lookup), but there are so many times when I've tried to write code that the compiler has rejected, but that wouldn't have been picked up in other static languages.
- LearnYouALisp 15y agoThank you for explaining. I had thought of type errors as different representations of numbers, for example.