Objectives

This section provides a calculus for recursive types. In particular, it deals with the implications of self-reference. Self-reference may occur on an object level, which reflects the meaning of the expression self in Smalltalk, current in Eiffel and this in C++. However, self-reference may also occur on a type level, as in the type expression like current of Eiffel. This section introduces the formal machinery needed to to demonstrate that allowing for like current types causes the Eiffel type system to be inconsistent.

Points to emphasize

Hints

Fixed points are needed to assign meaning to recursive structures. An intuitive understanding of fixed point characterizations may be obtained by applying unrolling.

Questions

    .so q6

Comments

The polymorphic nature of self clearly leads to problems when it functions as an anchor for a type specification, as in like current. The discussion presented in this chapter shows that such types are potentially dangerous.