Nominal Typing

Noun · Development

Definitions

  1. A type system where compatibility is determined by explicit declarations (class name, implements/extends) rather than structural similarity. Two types with identical fields are NOT compatible unless one explicitly extends/implements the other. Used by Java, C#, Swift, and Rust.

    In plain English: A type system where types must be explicitly declared as related — same shape alone doesn't make them compatible.

    Example: "In Java, Meters and Feet are different types even if both wrap an int — nominal typing prevents mixing them up."

Related Terms