Nominal subtyping (or user-defined subtyping) and structural subtyping each have their own strengths and weaknesses. Nominal subtyping allows programmers to explicitly express design intent, and, when types are associated with run time tags, enables run-time “type” tests (e.g., downcasts) and external/multimethod dispatch. On the other hand, structural subtyping is flexible and compositional, allowing unanticipated reuse. To date, nearly all object-oriented languages fully support only one subtyping paradigm or the other.
In this talk, I will describe a core calculus for a language that combines the key aspects of nominal and structural subtyping in a unified framework. The goal is to combine the flexibility of structural subtyping while still allowing static typechecking of external methods. Type safety has been proven for this language, and I will illustrate its practical utility through several examples which are not easily expressed in other languages.
Joint work with Jonathan Aldrich
of Programming Seminars