3

From C# 5.0 Specifications

4.4 Constructed types

A generic type declaration, by itself, denotes an unbound generic type that is used as a “blueprint” to form many different types, by way of applying type arguments. The type arguments are written within angle brackets (< and >) immediately following the name of the generic type. An unbound generic type can only be used within a typeof-expression (§7.6.11). A type that includes at least one type argument is called a constructed type. A constructed type can be used in most places in the language in which a type name can appear. An unbound generic type can only be used within a typeof-expression (§7.6.11).
Constructed types can also be used in expressions as simple names (§7.6.2) or when accessing a member (§7.6.4).

Is the concept of "constructed type" the same as the concept of "bounded generic type"?

4.4.3 Bound and unbound types

The term unbound type refers to a non-generic type or an unbound generic type. The term bound type refers to a non-generic type or a constructed type.

An unbound type refers to the entity declared by a type declaration. An unbound generic type is not itself a type, and cannot be used as the type of a variable, argument or return value, or as a base type. The only construct in which an unbound generic type can be referenced is the typeof expression (§7.6.11).

Is a non-generic type both an unbound and bound type?

Community
  • 1
  • 1
Tim
  • 1
  • 141
  • 372
  • 590
  • 1
    A nice (related) summary from Jon Skeet here too http://stackoverflow.com/a/1735060/1663001 – DavidG Apr 26 '17 at 23:52

1 Answers1

5

Is the concept of "constructed type" the same as the concept of "bounded generic type"?

Yes, modulo your typo. You meant to say "bound generic type", not "bounded generic type".

Is a non-generic type both an unbound and bound type?

Yes.

Why are the terms so redundant/duplicate/convoluted?

The terms were invented for the convenience of the specification authors and the compiler team. The only redundancy you've identified is that constructed is equal to bound generic, which seems pretty reasonable to me. I don't see any duplication or convolution.

If these terms seem complicated, well then I submit to you that type theory of modern line-of-business OO languages is a complicated subject; its jargon reflects that complexity.

It might help to think about it this way. Suppose we have a class C that takes n type arguments, for n >= 0:

  • The concept C-that-takes-n-type-arguments is an unbound type.
  • The concept C-with-n-type-arguments is a bound type.
  • A bound generic type must be a generic type that has been constructed with type arguments, so we call it a constructed type.

Plainly if n == 0 then C is both a bound and an unbound type at the same time.

Eric Lippert
  • 647,829
  • 179
  • 1,238
  • 2,067