Covariance and contravariance: conflict without a cause

@article{Castagna1995CovarianceAC,
  title={Covariance and contravariance: conflict without a cause},
  author={Giuseppe Castagna},
  journal={ACM Trans. Program. Lang. Syst.},
  year={1995},
  volume={17},
  pages={431-447}
}
  • G. Castagna
  • Published 1 May 1995
  • Computer Science
  • ACM Trans. Program. Lang. Syst.
In type-theoretic research on object-oriented programming, the issue of “covariance versus contravariance” is a topic of continuing debate. In this short note we argue that covariance and contravariance appropriately characterize two distinct and independent mechanisms. The so-called contravariance rule correctly captures the subtyping relation (that relation which establishes which sets of functions can replace another given set in every context). A covariant relation, instead, characterizes… 
Covariance and Controvariance: a fresh look at an old issue (a primer in advanced type systems for learning functional programmers)
  • G. Castagna
  • Computer Science
    Log. Methods Comput. Sci.
  • 2020
TLDR
This work reexamines the result of an article arguing that covariant and contravariant specialization of method parameters in object-oriented programming had different purposes and deduced that, not only they could, but actually they should both coexist in the same language.
Type-Safe Compilation of Covariant Specialization: A Practical Case
TLDR
This work proposes a modification to the O2 compiler that adds code to correct previously ill-typed computations that arise from the use of covariant specialization, and ensures the type safety (w.r.t. covariance) of the program.
Integration of parametric and “ad hoc” second order polymorphism in a calculus with subtyping
  • G. Castagna
  • Mathematics, Computer Science
    Formal Aspects of Computing
  • 2005
TLDR
An extension ofF≤ to which functions that dispatch on different terms according to the type they receive as argument are added, enriching the explicit parametric polymorphism of F≤ by an explicit “ad hoc” polymorphism (according to the classification of Str67).
An Operational Approach to the Semantics of Classes: Application to Type Checking
  • J. Royer
  • Mathematics, Computer Science
    Programming and Computer Software
  • 2004
TLDR
The model, called the Formal Class model, is an intermediate level between the algebraic specification of data type, and the implementation within an object-oriented language, equipped with an operational semantics based on conditional term rewriting.
Constrained Matching is Type Safe
TLDR
It is proved that this constrained matching guarantees type safe substitutability even in situations where matching alone would not, and can capture subtleties that go far beyond the level of expressiveness of object-oriented type systems.
"Real World" as an Argument for Covariant Specialization in Programming and Modeling
TLDR
It is claimed that type errors are part of the real world, so they should be taken into account at all stages of software development, and modeling as well as programming languages should adopt a covariant policy.
ECOOP’ 99 — Object-Oriented Programming
  • R. Guerraoui
  • Computer Science
    Lecture Notes in Computer Science
  • 1999
TLDR
A mathematical model and language for the formulation of assertions about objects and pointers are introduced, and a graphical calculus may help in reasoning about program correctness, which deals with both garbage-collected heaps and the other kind.
A Theory of Objects
TLDR
This book takes a novel approach to the understanding of object-oriented languages by introducing object calculi and developing a theory of objects around them, which covers both the semantics of objects and their typing rules.
Correspondence polymorphism for object-oriented languages
TLDR
A new form of polymorphism for object-oriented languages, called correspondence polymorphism, that lies in a different dimension than either parametric or subtype polymorphism is proposed, and formal type rules and an operational semantics for LCP are presented.
A lambda calculus of objects with self-inflicted extension
TLDR
A sound type system is presented for this calculus which guarantees that evaluating a well-typed expression will never yield a message-not-found run-time error and the resulting calculus appears to be a good starting point for a rigorous mathematical analysis of class-based languages.
...
1
2
3
4
5
...

References

SHOWING 1-10 OF 52 REFERENCES
Type-Safe Compilation of Covariant Specialization: A Practical Case
TLDR
This work proposes a modification to the O2 compiler that adds code to correct previously ill-typed computations that arise from the use of covariant specialization, and ensures the type safety (w.r.t. covariance) of the program.
A Calculus for Overloaded Functions with Subtyping
We present a simple extension of typed ?-calculus where functions can be overloaded by putting different "branches of code" together. When the function is applied, the branch to execute is chosen
A calculus for overloaded functions with subtyping
TLDR
It is shown that this calculus provides a foundation for typed object-oriented languages which solves some of the problems of the standard record-based approach and provides a type-discipline for a relevant fragment of the “core framework” of CLOS.
Developments in Object-Oriented Type Systems
TLDR
This work presents and discusses an interplay between OO and functional languages taking place over the last decade, a source of heated debate and some self-reeection in both camps.
Programming with intersection types and bounded polymorphism
This thesis unifies and extends prior work on intersection types and bounded quantification, previously studied only in isolation, by investigating theoretical and practical aspects of a typed
Intersection and Union Types: Syntax and Semantics
Type assignment systems with intersection and union types are introduced. Although the subject reduction property with respect to s-reduction does not hold for a natural deduction-like system, we
A semantics of multiple inheritance
There are two major ways of structuring data in programming languages. The first and common one, used for example in Pascal, can be said to derive from standard branches of mathematics. Data are
A Meta-Language for Typed Object-Oriented Languages
TLDR
This paper defines a meta-language based on λ& and shows, by a practical example, how it can be used it to prove properties of a language, and defines a toy object-oriented language and its type-checking algorithm, and translates this toy language into this meta- language.
A static type system for message passing
TLDR
An atomic linguistic construct is defined to capture the notion of message passing, and a static and strong type system, based on subtyping, is defined for this construct.
OBJ: Programming with Equalities, Subsorts, Overloading and Parameterization
TLDR
OBJ is a wide-spectrum language that elegantly integrates coding, specification and design into a single framework that supports overloading and subtypes.
...
1
2
3
4
5
...