TypeDefinition (API documentation of hlt.language packages)
Date: 2013-01-30

hlt.language.design.types

## Class TypeDefinition

- java.lang.Object
- - hlt.language.design.types.TypeTermScheme
  - - hlt.language.design.types.TypeDefinition

-     public class TypeDefinition
      extends TypeTermScheme

  This class encapsulates the information associated to a type term acting as an alias (or synonym) of another type.

  An object of this class consists of a (type) name, possibly along with some type parameters if it is polymorphic, and associated with a type defining it. Such type definitions are not opaque: the type terms are fully expanded into the definition they stand for and disappear altogether once this is done. In other words, using a this construct is paramount to using a shorthand notation; importantly, it does not create a new type. Thus, its purpose is simply to offer a syntactic convenience that may be used to enhance program legibility. Once defined with an object of this class, a type term with this name (possibly with type arguments if this definition is polymorphic) can be used anywhere a type is expected.

  If what is sought is an opaque type definition, then what is needed is a `DefinedType`.

  At any rate, look in `Tables` for the methods that will define a type alias (`DefineTypeAlias(...)`) or a new opaque type (`DefineNewType(...)`).

  See Also:
    `DefinedType`, `Tables`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Type` | `definition()` Returns a fresh copy of the type defining this definition's type term.
    `Type` | `instantiate(java.util.AbstractList types)` Returns a fresh copy of the type definition instantiated with the specified types.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class hlt.language.design.types.TypeTermScheme

      `arity, parameters`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### definition

          public final Type definition()

      Returns a fresh copy of the type defining this definition's type term.

    - #### instantiate

          public final Type instantiate(java.util.AbstractList types)
                                 throws StaticSemanticsErrorException

      Returns a fresh copy of the type definition instantiated with the specified types. It checks that the arities correspond. If no parameters exist for this definition but the type instances have a positive arity, an array of parameters is created with this arity. This is necessary in order to enforce that all instances of this type have the same arity.
      Throws:
        `StaticSemanticsErrorException`

    - #### toString

          public final java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`