Statically type-correct Eiffel programs may produce run-time errors because (1) attributes may be redeclared during inheritance, invalidating assignments in the superclass, (2) a formal method argument type may be restricted in violation of the contravariance of function types, and (3) two applications of a generic class are assumed to conform if the actual arguments conform. The third problem is solved by case analysis on the variance of generic parameters. Declaration by association provides a solution to the first two problems, but it suffers from additional difficulties. Type attributes, or generic parameters with default values, are suggested as a replacement for most cases of declaration by association. The special association type used to express type recursion cannot be explained using type attributes, and it appears to be a truly novel construct for typing object-oriented programs. One consequence of this construct is that Eiffel’s conformance hierarchy is a proper subset of its inheritance hierarchy. To appear in the Proceedings of the European Conference on ObjectOriented Programming, 10-14 July, 1989, and in The Computer Journal, September 1989.
[1]
Craig Schaffert,et al.
An introduction to Trellis/Owl
,
1986,
OOPSLA 1986.
[2]
William R. Cook,et al.
A denotational semantics of inheritance
,
1989
.
[3]
Bertrand Meyer,et al.
Genericity versus inheritance
,
1986,
OOPLSA '86.
[4]
A. Snyder.
CommonObjects: an overview
,
1986,
OOPWORK '86.
[5]
簡聰富,et al.
物件導向軟體之架構(Object-Oriented Software Construction)探討
,
1989
.
[6]
William R. Cook,et al.
Interfaces for strongly-typed object-oriented programming
,
1989,
OOPSLA '89.
[7]
Luca Cardelli,et al.
A Semantics of Multiple Inheritance
,
1984,
Information and Computation.
[8]
Luca Cardelli,et al.
A Semantics of Multiple Inheritance
,
1984,
Inf. Comput..
[9]
John C. Mitchell,et al.
F-bounded quantification for object-oriented programming
,
1989
.