Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Whenever I try to write code in Haskell that produces a type error I think, "there's another bug that would have been introduced in a lesser language".


Would a type error necessarily produce a "bug" in a program?


It 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.


Thank you for explaining. I had thought of type errors as different representations of numbers, for example.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: