Skip to main content
QUICK REVIEW

[Paper Review] Towards an Accurate Mathematical Model of Generic Nominally-Typed OOP

Moez A. AbdelGawad|arXiv (Cornell University)|Oct 14, 2016
Logic, programming, and type systemsComputer Science15 references4 citations
TL;DR

This paper proposes a domain-theoretic mathematical model, GNOOP, for generic nominally-typed OOP that integrates nominal typing and full generification to accurately capture complex features like variance annotations (e.g., Java wildcards) and type erasure. By introducing 'nominal intervals' and 'full generification', the model enables precise, type-safe modeling of generic subtyping and polymorphic methods in a way that structural models fail to achieve.

ABSTRACT

The construction of GNOOP as a domain-theoretic model of generic nominally-typed OOP is currently underway. This extended abstract presents the concepts of `nominal intervals' and `full generication' that are likely to help in building GNOOP as an accurate mathematical model of generic nominally-typed OOP. The abstract also presents few related category-theoretic suggestions. The presented concepts and suggestions are particularly geared towards enabling GNOOP to offer a precise and simple view of so-far-hard-to-analyze features of generic OOP such as variance annotations (e.g., Java wildcard types) and erased generics (e.g., Java type erasure).

Motivation & Objective

  • To develop a mathematically rigorous, domain-theoretic model of generic nominally-typed OOP that captures real-world language features such as variance annotations and type erasure.
  • To address the limitations of existing structural models in accurately representing nominal type systems and subtyping in generic OOP.
  • To unify the treatment of bounded type variables and variance annotations through the concept of nominal intervals.
  • To enable full generification of class signatures, replacing type variables with named intervals to support precise subtyping and type safety.
  • To provide a foundation for formal reasoning about complex generic features in mainstream languages like Java, C#, and Scala.

Proposed method

  • Introduces 'nominal intervals' as bounded type variables with explicit lower and upper bounds, enabling precise modeling of variance in generic types.
  • Proposes 'full generification' to transform class signatures by replacing all type references with nominal intervals, including synthetic ones for method parameters and return types.
  • Uses class signature constructors that take type arguments to generate ground class signatures, preserving full nominal type information.
  • Applies category-theoretic constructs to model subtyping and inheritance in a way that maintains one-to-one correspondence between type inheritance and subtyping.
  • Translates source code with wildcards and bounded types into equivalent generic forms using interval notation, e.g., [T: N-O] for type variables with bounds.
  • Extends the NOOP model to GNOOP by incorporating generic type parameters, bounds, and variance-aware subtyping rules through formalized signature constructors.

Experimental results

Research questions

  • RQ1How can a domain-theoretic model of generic nominally-typed OOP accurately represent variance annotations such as Java wildcards?
  • RQ2Can full generification eliminate ambiguity in type parameter binding and support correct modeling of type erasure and subtyping?
  • RQ3How can nominal intervals unify the treatment of bounded type variables and variance annotations in a single formal framework?
  • RQ4What is the role of nominal typing in enabling precise and simple modeling of complex generic features in OOP?
  • RQ5How can the model support polymorphic methods and bounded type parameters while avoiding circularity in type bounds?

Key findings

  • The introduction of nominal intervals enables precise modeling of bounded type variables and variance annotations, such as Java wildcards, by explicitly representing subtyping relationships.
  • Full generification transforms all type references in a class into named intervals, including synthetic ones for method parameters and return types, ensuring type safety and subtyping accuracy.
  • The model successfully translates Java-style wildcard types into equivalent generic forms using interval notation, e.g., List<? extends T> becomes [T2: List<T1>-List<T1>].
  • The approach resolves the conceptual mismatch between parametric polymorphism and subtyping polymorphism by unifying bounded types and variance under a single nominal interval framework.
  • The model supports polymorphic methods and bounded type parameters without circularity, by enforcing that type variables do not occur in their own bounds through a non-circularity convention.
  • The formal translation of example classes (e.g., Box, ListCopier) into fully generified forms demonstrates the model’s ability to preserve semantics while enabling formal reasoning.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.