Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Covariance and contravariance
Castagna G. ACM Transactions on Programming Languages and Systems17 (3):431-447,1995.Type:Article
Date Reviewed: Aug 1 1996

Ever since the O2 data model [1] and later the Eiffel language [2] introduced the concept of covariant specialization of methods, type theorists have argued whether it is better to use covariant or contravariant specialization for the methods in object-oriented languages. Castagna claims that this is a conflict without a cause.

It is generally believed that one has to use contravariance when static type safety is required, but that covariance is more natural, flexible, and expressive. Both approaches are very appealing, but they seem totally incompatible. As Castagna points out, however, there is a flaw in the comparison. He goes on to show that both covariance and contravariance can be used in a way that guarantees type safety.

He also contributes decisively to the debate, showing that the two concepts are not antagonistic, but that each has its own use. Covariance captures code specialization where the definition of new code replaces old definitions in some particular cases. Contravariance captures the subtyping relation, which states which sets of functions can replace another given set in every context.

Castagna keeps the presentation informal and at the same time precise. For those interested in type theory and type systems in object-oriented programming languages, this paper is definitely worth reading.

Reviewer:  D. B. Lange Review #: CR119384 (9608-0612)
1) Lécluse, C.; Richard, P.; and Vélez, F. O2, an object-oriented data model. In Proceedings of the 1988 ACM SIGMOD International Conference on Management of Data (Chicago, IL, June 1–3, 1988), H. Boral, Ed. ACM, New York, 1988, 424–433.
2) Meyer, B. Eiffel: the language. Prentice-Hall, Englewood Cliffs, NJ, 1991.
Bookmark and Share
 
Type Structure (F.3.3 ... )
 
 
Object-Oriented Languages (D.3.2 ... )
 
Would you recommend this review?
yes
no
Other reviews under "Type Structure": Date
Equational type logic
Manca V., Salibra A., Scollo G. (ed) Theoretical Computer Science 77(1-2): 131-159, 1990. Type: Article
Dec 1 1991
Data types over multiple-valued logics
Pigozzi D. Theoretical Computer Science 77(1-2): 161-194, 1990. Type: Article
Aug 1 1992
An algebraically specified language for data directed design
Wagner E. Theoretical Computer Science 77(1-2): 195-219, 1990. Type: Article
Jul 1 1991
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy