Covariância x Contravariância: A Solução de Ita

Marco Túlio de Oliveira Valente
TELEMIG

Roberto da Silva Bigonha
UFMG

An important question on type system design of object oriented languages is how the signature of a method can be redefined in a subclass. There are three possibilities, namely contravariance, invariance or covariance rules. The contravariance rule, as used in Sather, is the one which assures the type system correction. The covariance, used in Eiffel, although more flexible, allows the creation of expressions with hard to detect type errors. To solve the contravariance versus covariance problem, we suggest a new rule, named guarded contravariance, which was implemented in the language Ita. Such rule advocates the use of dynamic type verification in Oberon-2 style.

.