4 ms·
It has been my experience that it is difficult to get a bug passed the Hindley-Milner type system. Amusingly, this typo (passed instead of past) is an exampl
by raganwald 16y ago
It has been my experience that it is difficult to get a bug passed the
Hindley-Milner type system.
Amusingly, this typo (passed instead of past) is an example of the challenge facing language and tool developers. We can make a checking system isomorphic to a spell-checking system, but then we need a grammar-checking system to ensure that even if a word is correctly spelled, it forms a legal sentence. Once we have that, we need some sort of logic-checking system to make sure that a word with the correct spelling and the correct grammar is meaningful in the program. And so forth.
It's type-checking all the way up.
- chaosmachine 16y agoEven with perfect grammar, spelling, and logic checks, you're still going to lose sometimes: I mistyped a single letter in an email and offended a coworker for life. He was on the road; I was in the office. I argued persuasively about a difference in design, ending with "When you get it, we can talk some more". I had intended to say "When you get in, we can talk some more". http://news.ycombinator.com/item?id=1375231 http://news.ycombinator.com/item?id=1375231
- raganwald 16y agoI once commented on something, intending to say "Uh, have you considered..." But I wrote: Ugh. Have you considered... I had some 'splainin to do!
- chc 16y agoBut that's the thing about Hindley-Milner — most typos and logic errors will result in a different type than the one you intended. You'll get an infinite type or a number where you meant to get a list, etc. There are some bugs that can make it through, but the number of errors the type system can catch is amazing — it's actually close to being a logic checker.