Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Universal Type Inference is a Bad Thing (codecommit.com)
3 points by spooneybarger on Dec 16, 2010 | hide | past | favorite | 3 comments


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


When 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

Also, I submitted this before, but pointed at Odersky's comment. It made me LoL!11

http://news.ycombinator.com/item?id=2004639


Your 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?




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

Search: