Matches in DBpedia 2015-04 for { <http://dbpedia.org/resource/Covariance_and_contravariance_(computer_science)> ?p ?o }
Showing triples 1 to 22 of
22
with 100 triples per page.
- Covariance_and_contravariance_(computer_science) abstract "Many programming language type systems support subtyping. For instance, if Cat is subtype of Animal, then an expression of type Cat can be used whenever an expression of type Animal could. Variance refers to how subtyping between more complex types (list of Cats versus list of Animals, function returning Cat versus function returning Animal, ...) relates to subtyping between their components. Depending on the variance of the type constructor, the subtyping relation may be either preserved, reversed, or ignored. For example, in C#: IEnumerable<Cat> is a subtype of IEnumerable<Animal>. The subtyping is preserved because IEnumerable<T> is covariant on T. Action<Animal> is a subtype of Action<Cat>. The subtyping is reversed because Action<T> is contravariant on T. Neither IList<Cat> nor IList<Animal> is a subtype of the other, because IList<T> is invariant on T.The variance of a C# interface is determined by in/out annotations on its type parameters; the above interfaces are declared as IEnumerable<out T>, Action<in T>, and IList<T>. Types with more than one type parameter may specify different variances on each type parameter. For example, the delegate type Func<in T, out TResult> represents a function with a contravariant input parameter of type T and a covariant return value of type TResult.The typing rules for interface variance ensure type safety. For example, an Action<T> represents a first-class function expecting an argument of type T, and a function which can handle any type of animal can always be used instead of one which can only handle cats.A programming language designer will consider variance when devising typing rules for e.g. arrays, inheritance, and generic datatypes. By making type constructors covariant or contravariant instead of invariant, more programs will be accepted as well-typed. On the other hand, programmers often find contravariance unintuitive, and accurately tracking variance to avoid runtime type errors can lead to complex typing rules. In order to keep the type system simple and allow useful programs, a language may treat a type constructor as invariant even if it would be safe to consider it variant, or treat it as covariant even when that can violate type safety.".
- Covariance_and_contravariance_(computer_science) wikiPageExternalLink default.aspx.
- Covariance_and_contravariance_(computer_science) wikiPageExternalLink wiki?ContraVsCoVariance.
- Covariance_and_contravariance_(computer_science) wikiPageExternalLink closures-v05.html.
- Covariance_and_contravariance_(computer_science) wikiPageID "1104704".
- Covariance_and_contravariance_(computer_science) wikiPageRevisionID "643044010".
- Covariance_and_contravariance_(computer_science) hasPhotoCollection Covariance_and_contravariance_(computer_science).
- Covariance_and_contravariance_(computer_science) subject Category:Object-oriented_programming.
- Covariance_and_contravariance_(computer_science) subject Category:Polymorphism_(computer_science).
- Covariance_and_contravariance_(computer_science) subject Category:Type_theory.
- Covariance_and_contravariance_(computer_science) comment "Many programming language type systems support subtyping. For instance, if Cat is subtype of Animal, then an expression of type Cat can be used whenever an expression of type Animal could. Variance refers to how subtyping between more complex types (list of Cats versus list of Animals, function returning Cat versus function returning Animal, ...) relates to subtyping between their components.".
- Covariance_and_contravariance_(computer_science) label "Covariance and contravariance (computer science)".
- Covariance_and_contravariance_(computer_science) label "Kovarianz und Kontravarianz".
- Covariance_and_contravariance_(computer_science) label "Ковариантность и контравариантность (программирование)".
- Covariance_and_contravariance_(computer_science) label "共変性と反変性 (計算機科学)".
- Covariance_and_contravariance_(computer_science) sameAs Kovarianz_und_Kontravarianz.
- Covariance_and_contravariance_(computer_science) sameAs 共変性と反変性_(計算機科学).
- Covariance_and_contravariance_(computer_science) sameAs m.046c29.
- Covariance_and_contravariance_(computer_science) sameAs Q362031.
- Covariance_and_contravariance_(computer_science) sameAs Q362031.
- Covariance_and_contravariance_(computer_science) wasDerivedFrom Covariance_and_contravariance_(computer_science)?oldid=643044010.
- Covariance_and_contravariance_(computer_science) isPrimaryTopicOf Covariance_and_contravariance_(computer_science).