Wednesday, March 12, 2003 [Tweets] [Favorites]

Type Checking That Doesn’t Suck

These slides from a Perl talk include a good little introduction to ML- and Haskell-style type checking:

If we put a list of strings into our sort function, the compiler says that when it returns, it will have turned it into a list of ints. This is impossible. One possible explanation is that the sort function never returns. And in fact this is the case. The sort function, as we wrote it, goes into an infinite loop on any input except the empty list. This means that the type checker has found an infinite loop bug in our program. Ponder that for a minute.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment