Unifying Genericity - Combining the Benefits of Virtual Types and Parameterized Classes

Generic types in programming languages are most often supported with various forms of parametric polymorphism, i.e. functions on types. Within the framework of object-oriented languages, virtual types present an alternative where specific types are derived from generic ones using inheritance rather than function application. While both mechanisms are statically safe and support basic genericity, they have very different typing properties, each of them providing for the description of useful relationships, which are not expressible with the other. In this paper we present, through the use of examples, a mechanism for describing generic classes: structural virtual types. This mechanism is essentially a merger of parameterized classes and virtual types and includes the bene fits of both, in particular retaining mutual recursion and covariance of virtual types as well as the function-like nature of parameterized classes.

[1]  Martin Odersky,et al.  A Statically Safe Alternative to Virtual Types , 1998, ECOOP.

[2]  Kresten Krab Thorup Genericity in Java with Virtual Types , 1997, ECOOP.

[3]  Mads Torgersen Virtual types are statically safe , 1998 .

[4]  Martin Odersky,et al.  Making the future safe for the past: adding genericity to the Java programming language , 1998, OOPSLA '98.

[5]  Ole Lehrmann Madsen,et al.  Object-oriented programming in the BETA programming language , 1993 .

[6]  Ole Lehrmann Madsen,et al.  Virtual classes: a powerful mechanism in object-oriented programming , 1989, OOPSLA '89.

[7]  Martin Odersky,et al.  Pizza into Java: translating theory into practice , 1997, POPL '97.

[8]  Bertrand Meyer Genericity versus inheritance , 1986, OOPSLA 1986.

[9]  Stephen N. Freund,et al.  Adding type parameterization to the Java language , 1997, OOPSLA '97.

[10]  Craig Schaffert,et al.  Abstraction mechanisms in CLU , 1977 .

[11]  William Cook,et al.  A Proposal for Making Eiel Type-safe , 1989 .

[12]  William R. Cook,et al.  A Proposal for Making Eiffel Type-Safe , 1989, Comput. J..

[13]  Stephen M. Omohundro,et al.  The Sather programming language , 1993 .

[14]  John C. Mitchell,et al.  F-bounded quantification for object-oriented programming , 1989 .

[15]  Bent Bruun Kristensen,et al.  Abstraction mechanisms in the BETA programming language , 1983, POPL '83.

[16]  John C. Mitchell,et al.  F-bounded polymorphism for object-oriented programming , 1989, FPCA.

[17]  David Notkin,et al.  On the use of static typing to support operations on frameworks , 1996, Object Oriented Syst..

[18]  Andrew C. Myers,et al.  Parameterized types for Java , 1997, POPL '97.

[19]  Bjarne Stroustrup,et al.  The Annotated C++ Reference Manual , 1990 .

[20]  Object Oriented Programming Systems Languages and Applications Conference, OOPSLA 2000, Minneapolis, MN, USA, October 15-19, 2000, Addendum to the proceedings , 2000, OOPSLA Addendum.

[21]  Robert Cartwright,et al.  Compatible genericity with run-time types for the Java programming language , 1998, OOPSLA '98.