Objectives

This section discusses the distinction between types and classes. It characterizes types as predicates for type checking and classes as templates for object creation. Further, it distinguishes between the various possible interpretations of the notion of types and discusses how compatible modifications may be defined under each of these interpretations.

Points to emphasize

Hints

It is important to demonstrate that the categories discussed actually do have meaning. My favorite approach is to let students characterize a number of programming languages, including Smalltalk, Eiffel and C++, as having either a syntactic, semantic or pragmatic type system.

Questions

  1. How would you characterize the distinction between types and classes? Mention three ways of specifying types. How are these kinds related to each other?
  2. How would you characterize signature compatible modifications? Explain its weaknesses. What alternatives can you think of?

Comments

This section may be regarded as an introduction to the material that is presented in the next two chapters. It is important to show that subtyping is related to the subset relation, but not identical to it. Syntactically and semantically, additional constraints must be met.