Generic Identifier Component¶
The generic identifier component is the part of an identifier that is used to abstract away part of the types found in the value or type of a member. It can be thought of as the type parameter list of of a function.
It is represented by a listing of generic members (or single nominal identifiers – see Note below) each separated by a comma ,
and together surrounded by square brackets [
]
. For instance, the following snippet:
id[A, B <: Any]: [
a: A
b: B
]
represents a contract member generically identified with two type parameters A
and B <: Any
.
Note
Generic parameters may optionally be constrained by a type relationship. When no type relationship is specified for a certain type parameter, then any type can be specified for this type parameter in a generic accessor.
Note also that a type parameter that is constrained by an equal type bound =:
can only receive exactly one type.