Next: Basic Symbols
Up: ValuesObjects, Classes and
Previous: Types and Classes
The type dependence graph TDG of a program is an (acyclic) graph
whose nodes are the class types occurring in the program. There are
two kinds of arrows in TDG:
indicates that T' is
a type conforming to T.
indicates that T'
structurally conforms to T but is not necessarily a subtype of or
conformes to T', i.e.
the subtype inheritance clause may be missing but otherwise the same
requirements are fulfilled.
The precise definition of subtyping, conformance, and structural conformance is
recursive:
A class type T' structurally conforms to a class type T if
- T' and T are the same types, or if
- for every method g visible at the interface of T there
exists a method f visible at the interface of T' and f
conforms to g.
A class type T' conforms to a class type T if
- T' and T are the same types, or if
- T' is a subtype of a class type T'' conforming to
T.
A class type T' is a subtype of a class type T if
- T' structurally conforms to T, and
- T' contains an inheritance clause like T.
Any class type T is (automatically) a subtype of a polymorphic type
, cf. 8.1.
A method f conforms to a method g if
- both have the same name, and
- both define a procedure or both define a stream, and
- both have the same number of parameters, and for each pair of
parameters
of f,
of g
- the kind of the parameter, i.e. in-, out, inout- or once-parameter,
is the same, and
- if x is an in- or once-parameter then S conforms to S'
(contravariant conformance),
- if x is an out-parameter then S' conforms to S
(covariant conformance),
- if x is an inout-parameter then S,S' are the same type,
- if g has a result type R' then f has a result type
R conforming to R' (covariant conformance).
A method type T' conforms to a method type T if any method of type
T' conforms to a method of type T provided they have the same
name.
A stream object type conforms to another one if the stream types from
which these objects are established conform.
A method f conflicts with a method g if
- both have the same name, and
- both define a procedure or both define a stream, and
- both have the same number of parameters, and for each pair of
parameters
of f,
of g
- the kind of the parameter, i.e. in-, out, inout- or once-parameter,
is the same, and
- the types S,S' are the same or one of them is a polymorphic
type or a bound method type,
Note: The notion of conflict is used in overloading resolution,
cf. 5.1. If method g conforms to method f then it also
conflicts with f; the converse is not always true.
These definitions are also applicable to the methods generated from
attribute declarations within classes, cf. 4.5.
Next: Basic Symbols
Up: ValuesObjects, Classes and
Previous: Types and Classes
Martin Trapp
Mon Feb 17 16:49:16 MET 1997