Reputation: 33395
What is the correct terminology for a generic type with type parameter filled in? It's a very common construct; I'm surprised to realize I'm not sure exactly what it should be called.
Put another way:
If square
is a function, then square(2)
is a function call.
If List
is a generic type, then List<Int>
is a...?
(I'm working in Kotlin if it matters, though it seems to me the terminology should probably be the same for many languages that support generics.)
Upvotes: 4
Views: 133
Reputation: 15144
In C++, std::vector<int>
would be a specialization of std::vector<T>
, and std::array<int, N>
would be a partial specialization of std::array<T, N>
.
These are templates, however. As jaco0646 mentions, languages that use generics (such as Java and Rust) usually call them parameterized.
The closest equivalent in Haskell is typeclasses, and it (sometimes) calls the equivalent of parameterized generic code an instance. (In object-oriented languages, an instance refers to an object of a class, but Haskell does not have classes, so there is no ambiguity.)
Upvotes: 3
Reputation: 17066
In Java,
List<T>
is a Generic Type.List
is a Raw Type.List<Integer>
is a Parameterized Type.All types that support parameters are Generic Types.
When coding, one provides type arguments in order to create a parameterized type.
If no type arguments are provided, a raw type is created instead.
Upvotes: 5