From: Mark Guzdial guzdial@cc.gatech.edu So, I've taken to asking students (in oral exams, office hours, and the like) what evidence they have that "safe types" buys them anything? ... But this is actually more than me being "pedagogues who look on their profession as an opportunity for pederastic abuse" :-) I'm seriously interested: Does anyone know of any empirical evidence for the value of types? Or is it a myth that we invented to rationalize the typing needed to improve the compiler's performance? Much depends on the programming language. Types don't really buy you much in Pascal, for example. But in Ada they do, thanks to (compile-time) overloading. When I define a generic procedure or package in Ada, I can not only state the type parameters, but what operations they must support. This is in marked distinction to C++: just because the C++ compiler accepts a template class or template function does not mean that there are _any_ legal instantiations of it. In Clean, the type system lets me state uniqueness as well, so I can have efficient I/O and constant-time array update in a pure lazy functional language. There's also the usual Haskell-style type- class stuff (inheritance without objects).
Type inference systems such as those in Haskell and Clean let you - document (some of) your intentions - have type-dependent operations - check your code for consistency (not correctness) - find many errors *without* testing without requiring heavyweight type declarations.
It is perfectly true that many type errors would be caught by runtime checking, but only *if* the code in question happens to be tested.
It's all a matter of how much is checked, when it is checked, and how much it coes to have the checking done.
Do NOT take the type systems of Pascal and C++ as models of what a type system can do for you!
squeak-dev@lists.squeakfoundation.org