[PRL] Benjamin Pierce: Types Considered Harmful

William D Clinger will at ccs.neu.edu
Fri May 30 23:58:34 EDT 2008


Let me expand on my previous post.

Nowadays you young whippersnappers are inclined
to make a clear distinction between static type
checks and runtime safety checks, but that is a
relatively recent development.  People didn't
make that distinction back then, partly because
Pascal was regarded as the leading typed language
and Pascal's type system wasn't entirely static.

A complete implementation of Pascal's type system
would have included at least two kinds of runtime
checks: (1) dynamic checks for variant records,
and (2) range checks.

Wirth didn't implement (1), so most other Pascal
compilers didn't implement (1) either, which gave
rise to the false conclusion that Pascal's type
system was unsafe.  Not so; Pascal's type system
was safe, but its compilers were buggy.

On the other hand, virtually all Pascal compilers
implemented (2).  Those subrange checks were type
checks, because subranges are actual types in
Pascal; they were also expensive, because none of
the early Pascal compilers made any attempt to
optimize them away.

Hence the notion that types cause poor performance
had a genuine factual basis in Pascal.

Will



More information about the PRL mailing list