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 Systems 17 (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
Practical optional types for Clojure
Bonnaire-Sergeant A., Davies R., Tobin-Hochstadt S.  ESOP 2016 (Proceedings of the 25th European Symposium on Programming, Apr 2-8, 2016) 68-94, 2016. Type: Proceedings
Nov 22 2016
A typed store-passing translation for general references
Pottier F.  ACM SIGPLAN Notices 46(1): 147-158, 2011. Type: Article
Nov 1 2011
Formally verifying information flow type systems for concurrent and thread systems
Barthe G., Nieto L.  Formal methods in security engineering (Proceedings of the 2004 ACM Conference on Formal Methods in Security Engineering, Washington DC, USA,  Oct 29, 2004) 13-22, 2004. Type: Proceedings
Jan 12 2005
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright © 2000-2017 ThinkLoud, Inc.
Terms of Use
| Privacy Policy