[Paper Review] An Overview of Nominal-Typing versus Structural-Typing in Object-Oriented Programming (with code examples)
This paper presents a mathematical model, NOOP, that formalizes nominal typing in object-oriented programming, proving the equivalence between inheritance and subtyping in mainstream nominally-typed languages. It contrasts nominal typing with structural typing through conceptual definitions and code examples, establishing a foundation for understanding type system design in OOP.
NOOP is a mathematical model of nominally-typed OOP that proves the identification of inheritance and subtyping in mainstream nominally-typed OO programming languages and the validity of this identification. This report gives an overview of the main notions in OOP relevant to constructing a mathematical model of OOP such as NOOP. The emphasis in this report is on defining nominality, nominal typing and nominal subtyping of mainstream nominally-typed OO languages, and on contrasting the three notions with their counterparts in structurally-typed OO languages, i.e., with structurality, structural typing and structural subtyping, respectively. An additional appendix demonstrates these notions and other related notions, and the differences between them, using some simple code examples. A detailed, more technical comparison between nominal typing and structural typing in OOP is presented in other publications.
Motivation & Objective
- To formalize the relationship between inheritance and subtyping in nominally-typed OOP languages using a mathematical model.
- To define and contrast nominal typing, nominal subtyping, and nominality with their structural counterparts in object-oriented type systems.
- To provide conceptual clarity on how nominal typing differs from structural typing in mainstream OO languages.
- To demonstrate the distinctions through illustrative code examples in an appendix.
- To lay the groundwork for further technical comparison between nominal and structural typing in OOP.
Proposed method
- Developing the NOOP model as a formal mathematical framework for nominally-typed OOP.
- Defining nominality as a property of types based on explicit declarations and names.
- Formalizing nominal typing through name-based type equivalence and inheritance relationships.
- Contrasting nominal subtyping with structural subtyping using type compatibility rules based on names versus structure.
- Using code examples in an appendix to illustrate differences in type compatibility and inheritance.
- Establishing the validity of identifying inheritance with subtyping in nominally-typed systems through formal reasoning.
Experimental results
Research questions
- RQ1How does nominal typing in OOP differ from structural typing in terms of type identity and compatibility?
- RQ2To what extent can inheritance be formally identified with subtyping in nominally-typed languages?
- RQ3What are the formal characteristics of nominality that distinguish it from structurality in type systems?
- RQ4How do code examples illustrate the practical consequences of nominal versus structural typing?
- RQ5What foundational principles support the validity of subtyping as equivalent to inheritance in nominal systems?
Key findings
- The NOOP model successfully formalizes the identification of inheritance and subtyping in nominally-typed OOP languages.
- Nominal typing relies on explicit type names and declarations, distinguishing it from structure-based type compatibility.
- Structural subtyping allows compatibility based on type structure alone, independent of names or declarations.
- The model confirms that in nominally-typed systems, subtyping is validly grounded in inheritance relationships.
- Code examples in the appendix demonstrate that nominal typing enforces stricter type compatibility than structural typing.
- The distinction between nominal and structural typing is both conceptually and practically significant in OOP type system design.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.