TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:
HaloO,

John M. Dlugosz wrote:
Variance?

Yeah, the standard set of co-, contra-, in- and bivariance ;)

Assume A <: B being subtypes. Then how should Foo[A]
and Foo[B] relate?

   Foo[A] <: Foo[B]   # covariance
   Foo[B] <: Foo[A]   # contravariance

Invariance means there's no relation at all. And Bivariance
means both!

Regards, TSa.
The multi-dictionary search didn't show this usage of covariance and contravariance. But the series of articles on Type Theory in JOT uses it to mean "in the same direction" and "in the opposite direction" but doesn't define it as absolute subtyping directions. How is it being used in this mailing list?

I've thought about the issue, and it depends. The type parameters to the class might be annotated to indicate whether it is treated like a contained value type, is ignored, or what. But there are too many cases and the relationships are complex. Instead, it needs to look at the resulting public methods that involve the type parameters. It considers one a subtype of the other if they meet the requirements for method substitutability.
--John

Reply via email to