(object-oriented programming) The reversal of the order of data types acted upon by an operator.
contravariance
Definitions, parts of speech, synonyms, and sentence examples for contravariance.
Editorial note
A talented C# dev will need to know co/contravariance as well as implicits considering they also exist in C#.
Quick take
(object-oriented programming) The reversal of the order of data types acted upon by an operator.
Meaning at a glance
The clearest senses and uses of contravariance gathered in one view.
(linear algebra) Of vectors, the property of scaling inversely with a change of basis, as opposed to covariance.
(category theory) A functor which reverses composition.
Definitions
Core meanings and parts of speech for contravariance.
noun
(object-oriented programming) The reversal of the order of data types acted upon by an operator.
noun
(linear algebra) Of vectors, the property of scaling inversely with a change of basis, as opposed to covariance.
noun
(category theory) A functor which reverses composition.
Example sentences
A talented C# dev will need to know co/contravariance as well as implicits considering they also exist in C#.
It is not at all a stretch to say that the type mechanics of function composition are based on contravariance/covariance matching.
Certain features of OCaml's type system allow you to do subtyping, complete with type variable annotations to indicate covariance or contravariance.
Why the fuck should I need know about contravariance and parser combinators to write a basic web app?
In the event that we have mutability then we can violate covariance and contravariance as noted.
You also get the whole covariant/contravariance bit arising (solely) from function types.
Well, in practice the broken generics stop large amounts of reasonable uses of generics, the lack of co/contravariance force you into hideous workarounds everywhere.
Again, there's a weird flipping going on induced by the contravariance.
This is a fantastic explanation of covariance and contravariance.
Ultimately, this is the source of covariance and contravariance.
I've read simpler explanations of covariance and contravariance, but this is one of the most accessible illustrations of category theoretical concepts I've read.
> A talented C# dev will need to know co/contravariance as well as implicits considering they also exist in C#.
Quote examples
Covariance and contravariance are intimately related to "mapping" and only incidentally related to subtype polymorphism.
"Oh yeah, Java totally does covariance in generics by default, but not contravariance" Is this really useful knowledge?
To that list I'd add all the little "quality of life" framework additions, dynamic objects, covariance and contravariance changes, DLR, WPF 4, ASP.
Summary: The author reexamines his assertion that covariance and contravariance can coexist through recent advances in (sub-)typing theory by "explaining sophisticated type theoretic concepts, in simple terms and by examples, to undergraduate computer science students and/or willing functional programmers".
Frequently asked questions
Short answers drawn from the clearest meanings and examples for this word.
How do you use contravariance in a sentence?
A talented C# dev will need to know co/contravariance as well as implicits considering they also exist in C#.
What does contravariance mean?
(object-oriented programming) The reversal of the order of data types acted upon by an operator.
What part of speech is contravariance?
contravariance is commonly used as noun.