0

In computer science, what is the abstract common name of types and values (I mean an abstract "something" that can be a type or a value) ?

To be more specific:
If we have template <typename X> or template <int X> what is the abstract name of X?

6
  • Could you describe a little more the situation where this might arise? I cannot readily imagine a set of circumstances where one might encounter something without knowing whether that thing is a type or a term. Commented Sep 13, 2013 at 8:46
  • 1
    template <typename X> or template <int X> what is the abstract name of X?
    – Vincent
    Commented Sep 13, 2013 at 9:01
  • 2
    @Vincent Template parameter, but that's C++-specific terminology. Entity is sometimes used for very generic references to things in programming languages. Commented Sep 13, 2013 at 12:33
  • 2
    In a language like Coq you mix types and values quite frequently, they're all generically termed values, since types have "types" (called kinds) and kinds have types (called sorts) and so on and so on. Commented Sep 14, 2013 at 3:58
  • 1
    "What is the name of this thing" questions are off-topic. These are poor questions for the same reasons that "identify this obscure TV show, film or book by its characters or story" are bad questions: you can't Google them, they aren't practical in any way, they don't help anyone else, and allowing them opens the door for the asking of other types of marginal questions. See Also Let's Play the Guessing Game Commented Jan 21, 2014 at 13:08

1 Answer 1

3

Microsoft uses "type parameter" for C++ and C#. But that's Microsoft and not necessarily representative.

C# calls it a generic type parameter. See this MSDN article for details.

In a generic type or method definition, a type parameters is a placeholder for a specific type that a client specifies when they instantiate a variable of the generic type.

[emphasis added]

C++ calls it a type parameter. See this MSDN article for more details.

Templates, which are sometimes called parameterized types, are mechanisms for generating functions and classes based on type parameters.

[emphasis added]


Just to prove others use different terms, this article uses "type parameter" as well as "template parameter."

Recall that the standard containers actually have at least two parameters: the element type and an allocator type.

and then later on:

Notice that we've left out the name of template parameter in the declaration of List, above.


It's worth pointing out though that generics are not templates as explained in the linked article.

I think the key difference is:

Generics are generic until the types are substituted for them at runtime. Templates are specialized at compile time so they are not still parameterized types at runtime

Not the answer you're looking for? Browse other questions tagged or ask your own question.