Length: 90 minutes
I explain what typing is about, and why you might want it. I talk about the history of compile-time (static) type checking, and show some examples from FORTRAN (which does do it) and Lisp (which doesn't.) Then I show types in the ALGOL-derived languages, Pascal and C, and how they tried to extend static checking to aggregate types. I show that this has not worked well.
Since type checking in C and Pascal is a failure (and I have a big fit about this and foam at the mouth so that nobody dares disagree) there are two directions to go. You can give up on it, and many succesful langauges like Lisp, APL, Awk, and Perl do give up. This leads a lot of people to conclude that static type checking is a bad idea that has been abandoned.
But actually that's not so; it just shows that the inferior implementation in C and Pascal is a bad idea. Since C and Pascal were designed in the late 1960's, the state of the art has advanced, and languages like ML and Haskell have really good type systems.
I then spend about an hour showing examples of the ML type system. The big benefits here are: The type system is very fine-grained and flexible, so that there are many many types and you can be very specific about what type a certain value has. Types are deduced automatically by the compiler, so you don't need to declare them. Instead, you just write your code, and you look at the declarations that the compiler prints out and see if they were what you expected. If not, then your program almost certainly has a serious bug.
Finally, I talk about the possibility of adding good static type checking to Perl, and conclude that it's a lost cause because one of the essential features of Perl is that it automatically converts values from one type to another, which defeats the possibility of checking. I talk about the various hacks for run-time type checking in Perl, including strict 'refs' and the -w flag, and also some upcoming features for static type checking.
In addition to the slides, a complete writeup article is available.
Atypical Typing, a revised version of this talk, written for OOPSLA in 2008.
Return to: Universe of Discourse main page | Perl Paraphernalia | Other Classes and Talksmjdemail@example.com