Re: covariant and contravariant rules


Subject: Re: covariant and contravariant rules
From: Mayur Naik (naik@india.hp.com)
Date: Tue Dec 12 2000 - 05:45:54 PST


Vassily wrote:
>
> I am not sure in what context these terms are mentioned in the paper, but
> here is a simple example. Consider the type of a function taking
> arguments of types t1...tn and returning result of type tres:
>
> (t1...tn)->tres
>
> Such function type is "covariant" in tres and "contravariant" in t1...tn,
> which means that
>
> t1''<=t1'
> ...
> tn''<=tn'
> tres'<=tres''
>
> imply
>
> (t1'...tn')->tres' <= (t1''...tn'')->tres''
>
> Or, in other words, the former can be used whenever the latter is allowed.
>
> Does this answer your question?
> Vass
>

Yes. I wanted the meaning of these terms in OOP in general.

I have also heard about 'Liskov's Substitution Principle.' Is it the
same thing?

Thanks.

     -- Mayur



This archive was generated by hypermail 2b25 : Tue Dec 12 2000 - 05:46:05 PST