Mr. Grumpy writes:
> What is the ultimate purpose of type checking a program? The answer has
> to be, to avoid run-time errors. Beyond this, the type system seems to
> serve no purpose and so should not reject definitions such as that
> above, in an ideal world.
I agree that a valuable purpose of type-systems is to avoid run-time
errors, but that statement misses an important facet of type system
design. I would pose that the ultimate purpose of a type system is to
serve as a vehicle for communication between a human programmer and
the computer. The type system enables (and restricts!) the expression
of information about the programmer's internal model of the program's
intended structure. Error checking is a critical result of this
transaction between programmer and computer, but not the only one.
"Better" type systems permit the programmer to express models
embodying more information about the program. Results of this in
practice have been polymorphism, higher-order functions, and new
optimizations made possible by enforced program organization
(e.g. elimination of side-effects.)
-- John Whitley
(patiently waiting for a Haskell-descendant capable of
high-performance realtime audio DSP. :-)