ACM Home Page
Please provide us with feedback. Feedback
A first-class approach to genericity
Full text PdfPdf (357 KB)
Source Conference on Object Oriented Programming Systems Languages and Applications archive
Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applications table of contents
Anaheim, California, USA
SESSION: Generics table of contents
Pages: 96 - 114  
Year of Publication: 2003
ISBN:1-58113-712-5
Also published in ...
Authors
Eric Allen  Rice University, Houston, TX
Jonathan Bannet  Rice University, Houston, TX
Robert Cartwright  Rice University, Houston, TX
Sponsors
SIGPLAN: ACM Special Interest Group on Programming Languages
ACM: Association for Computing Machinery
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 7,   Downloads (12 Months): 55,   Citation Count: 11
Additional Information:

abstract   references   cited by   index terms   collaborative colleagues  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/949305.949316
What is a DOI?

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.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

1
 
2
E. Allen, J. Bannet, and R. Cartwright. Mixins in Generic Java are sound. Technical report, Rice University, 2002.
 
3
 
4
E. Allen and R. Cartwright. Safe instantiation in Generic Java. In Technical Report, Computer Science Department, Rice University, 2003. Available at http://www.cs.rice.edu/CS/PLT/Publications.
 
5
 
6
 
7
 
8
 
9
J. Bloch and N. Gafter. Personal communication, 2002.
 
10
11
 
12
G. Bracha, M. Odersky, D. Stoutamire, and P. Wadler. GJ Specification, 1998.
13
 
14
15
 
16
 
17
18
19
20
21
22
23
 
24
25
 
26
Sun Microsystems, Inc. JSR 14: Add generic types to the Java Programming Language, 2001.
 
27
Sun Microsystems, Inc. JSR-14 v1.3 prototype compiler source code, 2003. Available at http://www.jcp.org/en/jsr/detail?id=014.

CITED BY  11

Collaborative Colleagues:
Eric Allen: colleagues
Jonathan Bannet: colleagues
Robert Cartwright: colleagues