Advertisement

Walkabout Revisited: The Runabout

  • Christian Grothoff
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2743)

Abstract

We present a variation of the visitor pattern which allows programmers to write visitor-like code in a concise way. The Runabout is a library extension that adds a limited form of multi-dispatch to Java. While the Runabout is not as expressive as a general multiple dispatching facility, the Runabout can be significantly faster than existing implementations of multiple dispatch for Java, such as MultiJava. Unlike MultiJava, the Runabout does not require changes to the syntax and the compiler.

In this paper we illustrate how to use the Runabout, detail its implementation and provide benchmarks comparing its performance with other approaches.

Keywords

Dynamic Type Dynamic Code Visitor Pattern Innermost Loop Public Class 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Alpern, B., Cocchi, A., Fink, S.J., Grove, D., Lieber, D.: Efficient Implementation of Java Interfaces: Invokeinterface Considered Harmless. In: OOPSLA 2001 Conference on Object-Oriented Programming, Systems, Languages, and Applications, Tampa, Florida, pp. 108–124 (2001)Google Scholar
  2. 2.
    Bracha, G., Odersky, M., Stoutamire, D., Wadler, P.: Making the future safe for the past: Adding genericity to the Java programming language. In: OOPSLA Proceedings. ACM Press, Vancouver (1998)Google Scholar
  3. 3.
    Bravenboer, M., Visser, E.: Guiding visitors: Separating navigation from computation. Technical report, Institute of Information and Computing Sciences, Utrecht University (2001)Google Scholar
  4. 4.
    Breuel, T.M.: Implementing dynamic language features in java using dynamic code generation. In: Proceedings 39th International Conference and Exhibition on Technology of Object-Oriented Languages and Systems. TOOLS 39, pp. 143–52 (2001)Google Scholar
  5. 5.
    Chambers, C.: Object-oriented multi-methods in Cecil. In: Lehrmann Madsen, O. (ed.) ECOOP 1992. LNCS, vol. 615, pp. 33–56. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  6. 6.
    Chambers, C., Chen, W.: Efficient multiple and predicate dispatching. In: Proceedings of the 1999 ACM Conference on Object-Oriented Programming Languages, Systems, and Applications (OOPSLA 1999), ACM SIGPLAN Notices, Denver, CO, vol. 34(10), pp. 238–255. ACM, New York (1999)CrossRefGoogle Scholar
  7. 7.
    Clifton, C., Leavens, G.T., Chambers, C., Millstein, T.: MultiJava: Modular open classes and symmetric multiple dispatch for Java. In: OOPSLA 2000 Conference on Object-Oriented Programming, Systems, Languages, and Applications, Minneapolis, Minnesota, vol. 35(10), pp. 130–145 (2000)Google Scholar
  8. 8.
    Dietzfelbinger, M., Karlin, A.R., Mehlhorn, K., auf der Heide, F.M., Rohnert, H., Tarjan, R.E.: Dynamic perfect hashing: Upper and lower bounds. In: IEEE Symposium on Foundations of Computer Science, pp. 524–531 (1988)Google Scholar
  9. 9.
    Driesen, K., Hölzle, U., Vitek, J.: Message dispatch on pipelined processors. In: Olthoff, W. (ed.) ECOOP 1995. LNCS, vol. 952, pp. 253–283. Springer, Heidelberg (1995)Google Scholar
  10. 10.
    Dutchyn, C.: Multi-dispatch in the Java Virtual Machine: Design and implementation. Master’s thesis, Department of Computing Science, University of Alberta, Edmonton, Alberta, Canada (2001)Google Scholar
  11. 11.
    Flatt, M.: Programming Languages for Reusable Software Components. Technical Report TR99-345, 20 (1999)Google Scholar
  12. 12.
    Flatt, M., Felleisen, M.: Units: Cool modules for HOTlan guages. In: Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation, pp. 236–248 (1998)Google Scholar
  13. 13.
    Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and Mixins. In: Conference Record of POPL 1998: The 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, San Diego, California, New York, NY, pp. 171–183 (1998)Google Scholar
  14. 14.
    Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, Massachusetts (1994)Google Scholar
  15. 15.
    Gosling, J., Joy, B., Steele, G.: The Java Language Specification. Addison-Wesley, Reading (1996)zbMATHGoogle Scholar
  16. 16.
    Grothoff, C., Palsberg, J., Vitek, J.: Encapsulating Objects with Confined Types. In: OOPSLA 2001 Conference on Object-Oriented Programming, Systems, Languages, and Applications, Tampa, Florida, pp. 241–253 (2001)Google Scholar
  17. 17.
    Nordberg III, M.E.: Variations of the Visitor Pattern (1996)Google Scholar
  18. 18.
    Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., Griswold, W.G.: An Overview of AspectJ. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 327–355. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  19. 19.
    Krishnamurthi, S., Felleisen, M., Friedman, D.P.: Synthesizing Object-Oriented and Functional Design to Promote Re-use. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 91–113. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  20. 20.
    Naik, M., Kumar, R.: Efficient message dispatch in object-oriented systems. ACM SIGPLAN Notices 35(3), 49–58 (2000)CrossRefGoogle Scholar
  21. 21.
    Nystrom, N., Clarkson, M.R., Myers, A.C.: Polyglot: An Extensible Compiler Framework for Java. In: Hedin, G. (ed.) CC 2003. LNCS, vol. 2622, pp. 138–152. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  22. 22.
    Odersky, M., Wadler, P.: Pizza into Java: Translating Theory into Practice. In: Proceedings of the 24th ACM Symposium on Principles of Programming Languages (POPL 1997), Paris, France, pp. 146–159. ACM Press, New York (1997)Google Scholar
  23. 23.
    Ovlinger, J., Wand, M.: A Language for Specifying Traversals of Object Structures. Technical report, College of Computer Science, Northeastern University, Boston, MA (November 1998)Google Scholar
  24. 24.
    OVM Consortium (2002), http://www.ovmj.org/
  25. 25.
    Palacz, K., Baker, J., Flack, C., Grothoff, C., Yamauchi, H., Vitek, J.: Engineering a Customizable Intermediate Representation. In: ACM SIGPLAN 2003 Workshop on Interpreters, Virtual Machines and Emulators (IVME 2003), ACM SIGPLAN (2003)Google Scholar
  26. 26.
    Palsberg, J., Barry Jay, C.: The Essence of the Visitor Pattern. In: Proc. 22nd IEEE Int. Computer Software and Applications Conf., COMPSAC, pp. 9–15 (1998)Google Scholar
  27. 27.
    Stroustrup, B.: Multiple Inheritance for C++. In: Proceedings of the Spring 1987 European Unix Users Group Conference, Helsinki (1987)Google Scholar
  28. 28.
    Zenger, M., Odersky, M.: Implementing Extensible Compilers. In: Workshop on Multiparadigm Programming with Object-Oriented Languages, Budapest, Hungary (June 2001)Google Scholar
  29. 29.
    Zibin, Y., Gil (Y.) J.: Fast Algorithm for Creating Space Efficient Dispatching Tables with Application to Multi-Dispatching. In: OOPSLA 2002 Conference on Object-Oriented Programming, Systems, Languages, and Applications, Seattle, Washington, pp. 142–160 (2002)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Christian Grothoff
    • 1
  1. 1.S3 lab, Department of Computer SciencesPurdue University 

Personalised recommendations