Nominative Type System - Nominal Typing

Nominal Typing

Nominal typing means that two variables are type-compatible if and only if their declarations name the same type. For example, in C, two struct types with different names are never considered compatible, even if they have identical field declarations.

However, C also allows a typedef declaration, which introduces an alias for an existing type. These are merely syntactical and do not differentiate the type from its alias for the purpose of type checking. This feature, present in many languages, can result in a loss of type safety when (for example) the same primitive integer type is used in two semantically distinct ways. Haskell provides the C-style syntactic alias, as well as a declaration that does introduce a new, distinct type, isomorphic to an existing type.

Read more about this topic:  Nominative Type System

Famous quotes containing the word nominal:

    Discourage litigation. Persuade your neighbors to compromise whenever you can. Point out to them how the nominal winner is often a real loser—in fees, expenses, and waste of time. As a peacemaker the lawyer has a superior opportunity of being a good man. There will still be business enough.
    Abraham Lincoln (1809–1865)