An Entity of Type: Thing, from Named Graph: http://dbpedia.org, within Data Space: dbpedia.org

Many programming language type systems support subtyping. For instance, if the type <span class="n">Cat</span> is a subtype of <span class="n">Animal</span>, then an expression of type <span class="n">Cat</span> should be substitutable wherever an expression of type <span class="n">Animal</span> is used. On the other hand, "function from Animal to String" is a subtype of "function from Cat to String" because the function type constructor is contravariant in the parameter type. Here, the subtyping relation of the simple types is reversed for the complex types.

Property Value
dbo:abstract
  • لاتباين وتباين مرافق وتباين معاكس (Invariance، Covariance، and Contravariance) ثلاثة مفاهيم مترابطة تظهر سوية في العديد من الحقول بدأ من الإحصاء والاحتمال إلى فروع الفيزياء وغيرها. لذلك يشكل تكوين فكرة واضحة حول هذه المصطلحات أهمية للعديد من هذه العلوم. (ar)
  • In der objektorientierten Programmierung unterscheidet Kovarianz und Kontravarianz, ob ein Aspekt (d. h. eine Typdeklaration) gleichartig der Vererbungsrichtung (kovariant) oder entgegengesetzt zu dieser (kontravariant) ist. Liegt in der Unterklasse keine Änderung gegenüber der Oberklasse vor, wird das als Invarianz bezeichnet. Den Begriffen liegen die Überlegungen des Ersetzbarkeitsprinzips zugrunde: Objekte der Oberklasse müssen durch Objekte einer ihrer Unterklassen ersetzbar sein. Das bedeutet zum Beispiel, dass die Methoden der Unterklasse mindestens die Parameter akzeptieren müssen, die die Oberklasse auch akzeptieren würde (Kontravarianz). Die Methoden der Unterklasse müssen ebenfalls Werte zurückliefern, die mit der Oberklasse vereinbar sind, also nie allgemeineren Typs sind, als der Rückgabetyp der Oberklasse (Kovarianz). (de)
  • Many programming language type systems support subtyping. For instance, if the type <span class="n">Cat</span> is a subtype of <span class="n">Animal</span>, then an expression of type <span class="n">Cat</span> should be substitutable wherever an expression of type <span class="n">Animal</span> is used. Variance refers to how subtyping between more complex types relates to subtyping between their components. For example, how should a list of <span class="n">Cat</span>s relate to a list of <span class="n">Animal</span>s? Or how should a function that returns <span class="n">Cat</span> relate to a function that returns <span class="n">Animal</span>? Depending on the variance of the type constructor, the subtyping relation of the simple types may be either preserved, reversed, or ignored for the respective complex types. In the OCaml programming language, for example, "list of Cat" is a subtype of "list of Animal" because the list type constructor is covariant. This means that the subtyping relation of the simple types are preserved for the complex types. On the other hand, "function from Animal to String" is a subtype of "function from Cat to String" because the function type constructor is contravariant in the parameter type. Here, the subtyping relation of the simple types is reversed for the complex types. In other words, covariance is the quality of being different by being more specific (<span class="n">Cat</span> is covariant to <span class="n">Animal</span>) while contravariance is the quality of being different by being more general (<span class="n">Animal</span> is contravariant to <span class="n">Cat</span>). A programming language designer will consider variance when devising typing rules for language features such as 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 though that could violate type safety. (en)
  • La covarianza y la contravarianza son propiedades de la relación entre dos tipos compuestos, e indican si se mantiene o se invierte la relación de orden entre los tipos que los componen. Tienen especial relevancia en el diseño de lenguajes tipados, puesto que determinan cuándo es posible sustituir un tipo determinado por un subtipo o un supertipo. Sea por ejemplo un sistema de tipos en el que int y float identifican a los números enteros y racionales, respectivamente, que además guardan una relación de orden int ≤ float, indicando que int es un subtipo de float. Sea también int⟶ el tipo de una función que acepta un parámetro de tipo int. Si el sistema de tipos permite usar una función float⟶ en cualquier lugar donde se necesita una función int⟶, se dice entonces que las funciones son contravariantes en los argumentos, puesto que float⟶ ≤ int⟶ y en el tipo compuesto se invierte la relación de orden entre los tipos simples int ≤ float. Si en cambio se tiene una función ⟶float que devuelve un racional, y el sistema de tipos permite usar una función ⟶int que devuelve un entero en su lugar, entonces ⟶int ≤ ⟶float, y se dice que las funciones son covariantes en los valores de retorno.​​ En los lenguajes modernos se suele hablar de varianza,​​ y aplica no sólo a las relaciones de subtipado entre funciones libres, si no también a cómo funciona la especialización de métodos en subclases,​ o a cómo de restrictivos son los parámetros en los tipos compuestos que contienen genéricos.​ (es)
  • In informatica, covarianza e controvarianza sono proprietà che caratterizzano alcuni operatori sui tipi. Un operatore è covariante se conserva la relazione di sottotipo, controvariante se la inverte. Prendono il nome dalle omonime proprietà dei funtori in teoria delle categorie. (it)
  • (コンピュータプログラミングの型システムでの)共変性と反変性(きょうへんせいとはんぺんせい、covariance and contravariance)とは、データコンテナのサブタイプ関係が、そのデータ要素のサブタイプ関係に連動して定義されるという概念を指す。また、関数の型のサブタイプ関係での、引数型と返り値型の汎化特化の制約を定義する概念でもある。ジェネリックなデータ構造、関数の型、クラスのメソッド、ジェネリックなクラス、ジェネリック関数などに適用されている。 共変性と反変性は、圏論由来の用語である。この用語には以下の概念がある。 * 共変(covariant)は、派生 <: 基底 とすると、B <: A ならば I<b> <: I<a></a></b> * <a> <: I<b></b></a> * <b><a></a></b> * * (ja)
  • Ковариа́нтность и контравариа́нтность в программировании — способы переноса наследования типов на производные от них типы — контейнеры, обобщённые типы, делегаты и т. п. Термины произошли от аналогичных понятий теории категорий «ковариантный» и «контравариантный функтор». (ru)
  • Варіантність — у програмуванні, спосіб перенесення наслідування типів на нові типи попередніми (контейнери, узагальнені типи, ). Терміни виникли від термінів теорії категорій «коваріантний» та «контраваріантний» функтор. (uk)
dbo:thumbnail
dbo:wikiPageExternalLink
dbo:wikiPageID
  • 1104704 (xsd:integer)
dbo:wikiPageLength
  • 53081 (xsd:nonNegativeInteger)
dbo:wikiPageRevisionID
  • 1120227849 (xsd:integer)
dbo:wikiPageWikiLink
dbp:wikiPageUsesTemplate
dcterms:subject
rdfs:comment
  • لاتباين وتباين مرافق وتباين معاكس (Invariance، Covariance، and Contravariance) ثلاثة مفاهيم مترابطة تظهر سوية في العديد من الحقول بدأ من الإحصاء والاحتمال إلى فروع الفيزياء وغيرها. لذلك يشكل تكوين فكرة واضحة حول هذه المصطلحات أهمية للعديد من هذه العلوم. (ar)
  • In informatica, covarianza e controvarianza sono proprietà che caratterizzano alcuni operatori sui tipi. Un operatore è covariante se conserva la relazione di sottotipo, controvariante se la inverte. Prendono il nome dalle omonime proprietà dei funtori in teoria delle categorie. (it)
  • (コンピュータプログラミングの型システムでの)共変性と反変性(きょうへんせいとはんぺんせい、covariance and contravariance)とは、データコンテナのサブタイプ関係が、そのデータ要素のサブタイプ関係に連動して定義されるという概念を指す。また、関数の型のサブタイプ関係での、引数型と返り値型の汎化特化の制約を定義する概念でもある。ジェネリックなデータ構造、関数の型、クラスのメソッド、ジェネリックなクラス、ジェネリック関数などに適用されている。 共変性と反変性は、圏論由来の用語である。この用語には以下の概念がある。 * 共変(covariant)は、派生 <: 基底 とすると、B <: A ならば I<b> <: I<a></a></b> * <a> <: I<b></b></a> * <b><a></a></b> * * (ja)
  • Ковариа́нтность и контравариа́нтность в программировании — способы переноса наследования типов на производные от них типы — контейнеры, обобщённые типы, делегаты и т. п. Термины произошли от аналогичных понятий теории категорий «ковариантный» и «контравариантный функтор». (ru)
  • Варіантність — у програмуванні, спосіб перенесення наслідування типів на нові типи попередніми (контейнери, узагальнені типи, ). Терміни виникли від термінів теорії категорій «коваріантний» та «контраваріантний» функтор. (uk)
  • In der objektorientierten Programmierung unterscheidet Kovarianz und Kontravarianz, ob ein Aspekt (d. h. eine Typdeklaration) gleichartig der Vererbungsrichtung (kovariant) oder entgegengesetzt zu dieser (kontravariant) ist. Liegt in der Unterklasse keine Änderung gegenüber der Oberklasse vor, wird das als Invarianz bezeichnet. (de)
  • Many programming language type systems support subtyping. For instance, if the type <span class="n">Cat</span> is a subtype of <span class="n">Animal</span>, then an expression of type <span class="n">Cat</span> should be substitutable wherever an expression of type <span class="n">Animal</span> is used. On the other hand, "function from Animal to String" is a subtype of "function from Cat to String" because the function type constructor is contravariant in the parameter type. Here, the subtyping relation of the simple types is reversed for the complex types. (en)
  • La covarianza y la contravarianza son propiedades de la relación entre dos tipos compuestos, e indican si se mantiene o se invierte la relación de orden entre los tipos que los componen. Tienen especial relevancia en el diseño de lenguajes tipados, puesto que determinan cuándo es posible sustituir un tipo determinado por un subtipo o un supertipo. (es)
rdfs:label
  • لاتباين وتباين مرافق وتباين معاكس (ar)
  • Kovarianz und Kontravarianz (de)
  • Covarianza y contravarianza (ciencias de la computación) (es)
  • Covariance and contravariance (computer science) (en)
  • Covarianza e controvarianza (informatica) (it)
  • 共変性と反変性 (計算機科学) (ja)
  • 공변성과 반공변성 (컴퓨터 과학) (ko)
  • Ковариантность и контравариантность (программирование) (ru)
  • Коваріантність і контраваріантність (програмування) (uk)
  • 协变与逆变 (zh)
owl:sameAs
prov:wasDerivedFrom
foaf:depiction
foaf:isPrimaryTopicOf
is dbo:wikiPageDisambiguates of
is dbo:wikiPageRedirects of
is dbo:wikiPageWikiLink of
is foaf:primaryTopic of
Powered by OpenLink Virtuoso    This material is Open Knowledge     W3C Semantic Web Technology     This material is Open Knowledge    Valid XHTML + RDFa
This content was extracted from Wikipedia and is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License