3 ms·
Universal Type Inference is a Bad Thing
- wtracy 16y agoI remember hating ML when I had to use it in school. Yes, the compiler can infer all sorts of things about your code, and yes, it can use that to detect errors. But God help you figuring out where those errors are.
- isomorph 16y agoWhen I started ML, I used to get seriously annoyed when I'd try to compile something and it'd just say "type clash". Now I have mellowed. Also, annotating the types explicitly in the case of a type clash can be instructive as it usually reveals that you didn't write the function you thought you'd wrote... c.f. http://ezyang.com/haskell.html#FixingTypes http://ezyang.com/haskell.html#FixingTypes Also, I submitted this before, but pointed at Odersky's comment. It made me LoL!11 http://news.ycombinator.com/item?id=2004639 http://news.ycombinator.com/item?id=2004639
- Someone 16y agoYour statement is an argument against bad compilers or bad language design (in some languages it is neigh impossible for a parser/compiler to give meaningful error messages), not against type inference. What exactly would you prefer? A compiler that doesn't tell you that your code is buggy, but just runs it?