Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network

  Advanced Search  

Integrating Nominal and Structural Subtyping Donna Malayeri and Jonathan Aldrich

Summary: Integrating Nominal and Structural Subtyping
Donna Malayeri and Jonathan Aldrich
Carnegie Mellon University, Pittsburgh, PA 15213, USA,
{donna, aldrich}@cs.cmu.edu
Abstract. Nominal and structural subtyping each have their own strengths and
weaknesses. Nominal subtyping allows programmers to explicitly express de-
sign intent, and, when types are associated with run time tags, enables run-time
type tests and external method dispatch. On the other hand, structural subtyping
is flexible and compositional, allowing unanticipated reuse. To date, nearly all
object-oriented languages fully support one subtyping paradigm or the other.
In this paper, we describe a core calculus for a language that integrates the key
aspects of nominal and structural subtyping in a unified framework. We have also
merged the flexibility of structural subtyping with statically typechecked exter-
nal methods, a novel combination. We prove type safety for this language and
illustrate its practical utility through examples that are not easily expressed in
other languages. Our work provides a clean foundation for the design of future
languages that enjoy the benefits of both nominal and structural subtyping.
1 Introduction
In a language with structural subtyping, a type U is a subtype of T if its methods and
fields are a superset of T's methods and fields. The interface of a class is simply its


Source: Aldrich, Jonathan - School of Computer Science, Carnegie Mellon University


Collections: Computer Technologies and Information Sciences