Terminology for Generics

From Appmethod Topics
Jump to: navigation, search

Go Up to Generics Index

Terms Used in Describing Generics

Terminology used to describe generics is defined in this section.

Type generic

A type declaration that requires type parameters to be supplied in order to form an actual type.
List<Item> is a type generic (or generic) in the following example:

type
  List<Item> = class
  ...
  end;

Generic

Same as Type generic.

Type parameter

A parameter declared in a generic declaration or a method header in order to use as a type for another declaration inside its generic declaration or the method body. It will be bound to a particular type argument. Item is a type parameter in the following example:

type
  List<Item> = class
  ...
  end;

Type argument
and
Type identifier

A particular type used with a type identifier in order to make an instantiated type. Using the previous example, List<Integer> is the instantiated type (instantiated generic), List is the type identifier, and Integer is the type argument.

Instantiated type

The combination of a generic with a set of parameters.

Constructed type

Same as instantiated type.

Closed constructed type

A constructed type having all its parameters resolved to actual types. List<Integer> is closed because Integer is an actual type.

Open constructed type

A constructed type having at least one parameter that is a type parameter. If T is a type parameter of a containing class, List<T> is an open constructed type.

Instantiation

The compiler generates real instruction code for methods defined in generics and real virtual method table for a closed constructed type. This process is required before emitting a Object Pascal compiled unit file (.dcu) or object file (.obj).

See Also