Skip to main content

Unifying Genericity

Combining the Benefits of Virtual Types and Parameterized Classes

  • Conference paper
  • First Online:
Book cover ECOOP’ 99 — Object-Oriented Programming (ECOOP 1999)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1628))

Included in the following conference series:

Abstract

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 benefits of both, in particular retaining mutual recursion and covariance of virtual types as well as the function-like nature of parameterized classes.

Currently visiting Professor Akinori Yonezawa at University of Tokyo, Japan.

★★

Currently visiting Luca Cardelli at Microsoft Research, Cambridge, UK.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. ABB+98._Ole Agesen, Gilad Bracha, Kim Bruce, Luca Cardelli, Corky Cartwright, Erik Ernst, Kathleen Fisher, Martin Odersky, Bill Joy, Benjamin Pierce, John Rose, Guy Steele, Jr., David Stoutamire, Kresten Krab Thorup, Mads Torgersen, David Ungar, Philip Wadler, et al. Personal communication. The “Java Genericity” mailing list, 1997–1998.

    Google Scholar 

  2. Ole Agesen, Stephen N. Freund, and John C. Mitchell. Adding type parameterization to the java programming language. In Object Oriented Programming: Systems, Languages and Applications (OOPSLA). ACM, October 1997.

    Google Scholar 

  3. Gilad Bracha, Martin Odersky, David Stoutamire, and Philip Wadler. Making the future safe for the past: Adding genericity to the java programming language. In Chambers [Cha98].

    Google Scholar 

  4. Kim Bruce, Martin Odersky, and Philip Wadler. A statically safe alternative to virtual types. In European Conference on Object-Oriented Programming (ECOOP), 1998.

    Google Scholar 

  5. Kim Bruce. Subtyping is not a good match for object-oriented programming languages. In Mehmet Aksit and Satoshi Matsouka, editors, European Conference on Object-Oriented Programming (ECOOP), number 1241 in LNCS, Jyväskylä, Finland, 1997. AiTO, Springer Verlag.

    Google Scholar 

  6. Peter Canning, William Cook, Walt Hill, Walter Olthoff, and John Mitchell.F-bounded qualification for object-oriented programming. In ACM Conference on Functional Programming and Computer Architecture. ACM Press, 1989.

    Google Scholar 

  7. Craig Chambers, editor. Object Oriented Programming: Systems, Languages and Applications (OOPSLA), Vancouver, BC, October 1998. SIGPLAN, ACM Press.

    Google Scholar 

  8. William Cook. A proposal for making Eiffel type-safe. In Stephen Cook, editor, European Conference on Object-Oriented Programming (ECOOP), pages 57–70, Nottingham, July 1989. AiTO, Nottingham University Press.

    Google Scholar 

  9. Robert Cartwright and Guy L. Steele. Compatible genericity with runtime-types for the Java programming language. In Chambers [Cha98].

    Google Scholar 

  10. Margaret A. Ellis and Bjarne Stroustrup. The Annotated C++ Reference Manual. Addison-Wesley, 1990.

    Google Scholar 

  11. Atsushi Igarashi and Benjamin C. Pierce. Foundations for virtual types. In Rachid Guerraoui, editor, European Conference on Object-Oriented Programming (ECOOP), LNCS, Lisbon, Portugal, 1999. AiTO, Springer Verlag.

    Google Scholar 

  12. Niel D. Jones, editor. Conf. Proceedings of the 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), Paris, January 1997. ACM Press.

    Google Scholar 

  13. Bent Bruun Kristensen, Ole Lehrmann Madsen, Birger Møller-Pedersen, and Kristen Nygaard. Abstraction mechanisms in the Beta programming language. In Conf. Proceedings of the 10th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), Austin, TX, 1983.

    Google Scholar 

  14. Barbara Liskov, Alan Snyder, Russel Atkinson, and Craig Schaffert. Abstraction mechanisms in CLU. Communications of the ACM, 20(8), August 1977.

    Google Scholar 

  15. Boris Magnusson. Code reuse considered harmful. JOOP Journal of Object-Oriented Programming, 4(3), November 1991.

    Google Scholar 

  16. Andrew Myers, Joseph Bank, and Barbara Liskov. Parameterized types for Java. In Jones [Jon97].

    Google Scholar 

  17. Bertrand Meyer. Genericity versus inheritance. In Object Oriented Programming: Systems, Languages and Applications (OOPSLA), pages 391–405, 1986.

    Google Scholar 

  18. Mjølner Informatics, ApS, Aarhus. The Mjølner System BETA Compiler Reference Manual, 1997. MIA 90-02(1.6), http://www.mjolner.dk.

  19. Ole Lehrmann Madsen and Birger Møller-Pedersen. Virtual classes: A powerful mechanism in object-oriented programming. In Object Oriented Programming: Systems, Languages and Applications (OOPSLA). SIGPLAN, ACM Press, 1989.

    Google Scholar 

  20. Ole Lehrmann Madsen, Birger Møller-Pedersen, and Kristen Nygaard. Object-Oriented Programming in the BETA Programming Language. Addison-Wesley, 1993.

    Google Scholar 

  21. Gail C. Murphy and David Notkin. The interaction between static typing and frameworks. Technical Report TR-93-09-02, University of Washington, 1993.

    Google Scholar 

  22. Gail C. Murphy and David Notkin. On the use of static typing to support operations on frameworks. Object Oriented Systems, 3(4):197–213, December 1996.

    Google Scholar 

  23. Steven Omohundro. The Sather programming language. Dr. Dobb’s Journal, 18(11), October 1993.

    Google Scholar 

  24. Martin Odersky and Philip Wadler. Pizza into Java: Translating theory into practice. In Jones [Jon97].

    Google Scholar 

  25. David Shang. Subtypes and convertible types. Object Currents, 1(6), June 1996.

    Google Scholar 

  26. David Shang. Transframe: The Annotated Reference. Software Systems Research Laboratory, Motorola, Inc., Shamburg, IL, November 1996. http://www.transframe.com.

    Google Scholar 

  27. Kresten Krab Thorup. Genericity in Java with virtual types. In Mehmet Akşit and Satoshi Matsouka, editors, European Conference on Object-Oriented Programming (ECOOP), number 1241 in LNCS, pages 444–471, Jyväskylä, Finland, 1997. AiTO, Springer Verlag.

    Google Scholar 

  28. Mads Torgersen. Virtual types are statically safe. In Kim Bruce, editor, 5th Workshop on Foundations of Object-Oriented Languages, San Diego, CA, January 1998.

    Google Scholar 

  29. Kresten Krab Thorup and Mads Torgersen. Structured virtual types. Informal session on types for Java, 5thWorkshop on Foundations of Object-Oriented Languages, January 1998.

    Google Scholar 

  30. Kresten Krab Thorup and Mads Torgersen. The Idea programming language. Technical report, Department of Computer Science, University of Aarhus, 1999. (To appear).

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1999 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Krab Thorup, K., Torgersen, M. (1999). Unifying Genericity. In: Guerraoui, R. (eds) ECOOP’ 99 — Object-Oriented Programming. ECOOP 1999. Lecture Notes in Computer Science, vol 1628. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-48743-3_9

Download citation

  • DOI: https://doi.org/10.1007/3-540-48743-3_9

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-66156-6

  • Online ISBN: 978-3-540-48743-2

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics