In
type theory and
programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
s, a type variable is a
mathematical variable ranging over
types
Type may refer to:
Science and technology Computing
* Typing, producing text via a keyboard, typewriter, etc.
* Data type, collection of values used for computations.
* File type
* TYPE (DOS command), a command to display contents of a file.
* Ty ...
. Even in programming languages that allow
mutable variables, a type variable remains an abstraction, in the sense that it does not correspond to some memory locations.
Programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
s that support
parametric polymorphism make use of
universally quantified type variables. Languages that support
existential types make use of
existentially quantified type variables. For example, the following
OCaml code defines a polymorphic
identity function that has a universally quantified type, which is printed by the interpreter on the second line:
# let id x = x;;
val id : 'a -> 'a =
In mathematical notation, the type of the function
id
is
, where
is a type variable.
See also
*
System F
{{type-theory-stub
Type theory
Functional programming
Dependently typed programming