A first-class approach to genericity
This thesis describes how to add first-class generic types---including mixins---to strongly-typed object-oriented languages with nominal subtyping such as Java and C#. A generic type system is "first-class" if generic types can appear in any context where conventional types can appear. In...
Main Author: | |
---|---|
Other Authors: | |
Format: | Others |
Language: | English |
Published: |
2009
|
Subjects: | |
Online Access: | http://hdl.handle.net/1911/18503 |
id |
ndltd-RICE-oai-scholarship.rice.edu-1911-18503 |
---|---|
record_format |
oai_dc |
spelling |
ndltd-RICE-oai-scholarship.rice.edu-1911-185032013-10-23T04:14:14ZA first-class approach to genericityAllen, Eric EthanComputer ScienceThis thesis describes how to add first-class generic types---including mixins---to strongly-typed object-oriented languages with nominal subtyping such as Java and C#. A generic type system is "first-class" if generic types can appear in any context where conventional types can appear. In this context, a mixin is simply a generic class that extends one of its type parameters, e.g., a class C<T> that extends T. Although mixins of this form are widely used in C++ (via templates), they are clumsy and error-prone because C++ treats mixins as syntactic abbreviations (macros), forcing each mixin instantiation to be separately compiled and type-checked. The abstraction embodied in a mixin is never separately analyzed. Our formulation of mixins using first-class genericity accommodates sound local (class-by-class) type checking. A mixin can be fully type-checked given symbol tables for each of the classes that it directly references---the same context in which Java performs incremental class compilation. To our knowledge, no previous formal analysis of first-class genericity in languages with nominal type systems has been conducted, which is surprising because nominal type systems have become predominant in mainstream object-oriented programming languages. What makes our treatment of first-class genericity particularly interesting and important is the fact that it can be added to the existing Java language without any change to the underlying Java Virtual Machine. Moreover, the extension is backward compatible with legacy Java source and class files. Although our discussion of implementation issues focuses on Java, the same implementation techniques could be applied to other object-oriented languages such as C# or Eiffel that support incremental compilation, dynamic class loading, and a static type system with nominal subtyping.Cartwright, Robert2009-06-04T08:37:23Z2009-06-04T08:37:23Z2003ThesisText160 p.application/pdfhttp://hdl.handle.net/1911/18503eng |
collection |
NDLTD |
language |
English |
format |
Others
|
sources |
NDLTD |
topic |
Computer Science |
spellingShingle |
Computer Science Allen, Eric Ethan A first-class approach to genericity |
description |
This thesis describes how to add first-class generic types---including mixins---to strongly-typed object-oriented languages with nominal subtyping such as Java and C#. A generic type system is "first-class" if generic types can appear in any context where conventional types can appear. In this context, a mixin is simply a generic class that extends one of its type parameters, e.g., a class C<T> that extends T. Although mixins of this form are widely used in C++ (via templates), they are clumsy and error-prone because C++ treats mixins as syntactic abbreviations (macros), forcing each mixin instantiation to be separately compiled and type-checked. The abstraction embodied in a mixin is never separately analyzed.
Our formulation of mixins using first-class genericity accommodates sound local (class-by-class) type checking. A mixin can be fully type-checked given symbol tables for each of the classes that it directly references---the same context in which Java performs incremental class compilation. To our knowledge, no previous formal analysis of first-class genericity in languages with nominal type systems has been conducted, which is surprising because nominal type systems have become predominant in mainstream object-oriented programming languages.
What makes our treatment of first-class genericity particularly interesting and important is the fact that it can be added to the existing Java language without any change to the underlying Java Virtual Machine. Moreover, the extension is backward compatible with legacy Java source and class files. Although our discussion of implementation issues focuses on Java, the same implementation techniques could be applied to other object-oriented languages such as C# or Eiffel that support incremental compilation, dynamic class loading, and a static type system with nominal subtyping. |
author2 |
Cartwright, Robert |
author_facet |
Cartwright, Robert Allen, Eric Ethan |
author |
Allen, Eric Ethan |
author_sort |
Allen, Eric Ethan |
title |
A first-class approach to genericity |
title_short |
A first-class approach to genericity |
title_full |
A first-class approach to genericity |
title_fullStr |
A first-class approach to genericity |
title_full_unstemmed |
A first-class approach to genericity |
title_sort |
first-class approach to genericity |
publishDate |
2009 |
url |
http://hdl.handle.net/1911/18503 |
work_keys_str_mv |
AT allenericethan afirstclassapproachtogenericity AT allenericethan firstclassapproachtogenericity |
_version_ |
1716610937554731008 |