Title
A first-class approach to genericity
Abstract
This paper describes how to add first-class generic types---including mixins---to strongly-typed OO 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 Cpp (via templates), they are clumsy and error-prone because Cpp treats mixins as 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 subtyping has 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 a practical implementation strategy 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 nominal subtyping.
Year
DOI
Venue
2003
10.1145/949305.949316
OOPSLA '03 Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applications
Keywords
Field
DocType
conventional type,existing java language,first-class genericity accommodates,static type system,nominal type system,class c,class file,generic type system,first-class genericity,nominal subtyping,underlying java virtual machine,type checking,first-class approach,first-class generic type,generic type,dynamic class loading,legacy java source,object oriented programming languages,type system,object oriented language,sound localization
Programming language,Scala,Mixin,Computer science,Java annotation,Java concurrency,Real time Java,Theoretical computer science,Generics in Java,Java Modeling Language,Java
Conference
Volume
Issue
ISSN
38
11
0362-1340
ISBN
Citations 
PageRank 
1-58113-712-5
28
1.15
References 
Authors
25
3
Name
Order
Citations
PageRank
Eric Allen19410.84
Jonathan Bannet2614.06
Robert Cartwright352967.27