Objectives
This section gives a formal characterization of
the subtype relation for ranges,
functions, records and variant
records.
It starts with a characterization of types
as sets of values.
The subtype relation itself is characterized
by means of rules, stating how a given type
may be refined into a subtype.
In particular, the contravariance
rule for function subtypes is discussed.
This section also introduces the notion
of objects as records, originally due
to [Ca84].
Points to emphasize
- types -- sets of values
- the subtype relation -- refinement rules
- functions -- contravariance
- objects -- as records
Hints
The business metaphor of refining a service
provides a suitable vehicle to convey
our understanding of the subtyping
rules, in particular the contravariance
rules for function subtypes.
By extension, this metaphor also applies
to the subtyping relation for objects,
as refining a contract.
Questions
.so q2
Comments
The notion of objects as records
presents itself as a natural
interpretation of objects as encountered
in Eiffel and C++.
However, the interpretation of objects
as functions is probably equally or more
natural from the perspective of CLOS users.