Handbook of Computer Science and Engineering, Chapter 103. CRC Press, 1997.
1996 by Digital Equipment Corporation. Revised Friday, March 28, 1997, 4:45 pm.
The fundamental purpose of a
is to prevent the occurrence of
during the running of a program. This informal statement motivates the study of
type systems, but requires clarification. Its accuracy depends, first of all, on the rather
subtle issue of what constitutes an execution error, which we will discuss in detail.
Even when that is settled, the absence of execution errors is a nontrivial property.
When such a property holds for all of the program runs that can be expressed within a
programming language, we say that the language is
. It turns out that a fair
amount of careful analysis is required to avoid false and embarrassing claims of type
soundness for programming languages. As a consequence, the classification, descrip-
tion, and study of type systems has emerged as a formal discipline.
The formalization of type systems requires the development of precise notations
and definitions, and the detailed proof of formal properties that give confidence in the
appropriateness of the definitions. Sometimes the discipline becomes rather abstract.
One should always remember, though, that the basic motivation is pragmatic: the ab-
stractions have arisen out of necessity and can usually be related directly to concrete
intuitions. Moreover, formal techniques need not be applied in full in order to be useful
and influential. A knowledge of the main principles of type systems can help in avoid-
ing obvious and not so obvious pitfalls, and can inspire regularity and orthogonality in
When properly developed, type systems provide conceptual tools with which to
judge the adequacy of important aspects of language definitions. Informal language
descriptions often fail to specify the type structure of a language in sufficient detail to
allow unambiguous implementation. It often happens that different compilers for the
same language implement slightly different type systems. Moreover, many language
definitions have been found to be type unsound, allowing a program to crash even
though it is judged acceptable by a
. Ideally, formal type systems should
be part of the definition of all typed programming languages. This way, typechecking
algorithms could be measured unambiguously against precise specifications and, if at
all possible and feasible, whole languages could be shown to be type sound.
In this introductory section we present an informal nomenclature for typing, exe-
cution errors, and related concepts. We discuss the expected properties and benefits of
type systems, and we review how type systems can be formalized. The terminology
used in the introduction is not completely standard; this is due to the inherent incon-
sistency of standard terminology arising from various sources. In general, we avoid the
Digital Equipment Corporation
Systems Research Center