Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Type variable

From Wikipedia, the free encyclopedia
icon
This articledoes notcite anysources. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged andremoved.
Find sources: "Type variable" – news ·newspapers ·books ·scholar ·JSTOR
(January 2025) (Learn how and when to remove this message)

Intype theory andprogramming languages, atype variable is amathematical variable ranging overtypes. Even in programming languages that allowmutable variables, a type variable remains an abstraction, in the sense that it does not correspond to some memory locations.

Programming languages that supportparametric polymorphism make use ofuniversally quantified type variables. Languages that supportexistential types make use ofexistentially quantified type variables. For example, the followingOCaml code defines a polymorphicidentity function that has a universally quantified type, which is printed by the interpreter on the second line:

#letidx=x;;valid:'a->'a=<fun>

In mathematical notation, the type of the functionid isa.aa{\displaystyle \forall a.a\to a}, wherea{\displaystyle a} is a type variable.

See also

[edit]
Γ{\displaystyle \Gamma \!\vdash }

Thisprogramming language theory ortype theory-related article is astub. You can help Wikipedia byadding missing information.

Retrieved from "https://en.wikipedia.org/w/index.php?title=Type_variable&oldid=1268060736"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp