skip to main content
10.1145/1449764.1449808acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Multiple dispatch in practice

Authors Info & Claims
Published:19 October 2008Publication History

ABSTRACT

Multiple dispatch uses the run time types of more than one argument to a method call to determine which method body to run. While several languages over the last 20 years have provided multiple dispatch, most object-oriented languages still support only single dispatch forcing programmers to implement multiple dispatch manually when required. This paper presents an empirical study of the use of multiple dispatch in practice, considering six languages that support multiple dispatch, and also investigating the potential for multiple dispatch in Java programs. We hope that this study will help programmers understand the uses and abuses of multiple dispatch; virtual machine implementors optimise multiple dispatch; and language designers to evaluate the choice of providing multiple dispatch in new programming languages.

References

  1. Gareth Baxter, Marcus Frean, James Noble, Mark Rickerby, Hayden Smith, Matt Visser, Hayden Melton, and Ewan Tempero. Understanding the shape of Java software. In OOPSLA, pages 397--412, Portland, OR, USA, 2006. ACM Press. Google ScholarGoogle Scholar
  2. Daniel G. Bobrow. The LOOPS Manual. Xerox Parc, 1983.Google ScholarGoogle Scholar
  3. Daniel G. Bobrow, Kenneth Kahn, Gregor Kiczales, Larry Masinter, Mark Stefik, and Frank Zdybel. CommonLoops: Merging Lisp and object-oriented programming. SIGPLAN Not, 21:17--29, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Daniel G. Bobrow, Linda G. DeMichiel, Richard P. Gabriel, Sonya E. Keene, Gregor Kiczales, and David A. Moon. Common Lisp Object System specification. SIGPLAN Not, 23:1--142, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Daniel Bonniot, Bryn Keller, and Francis Barber. The Nice user's manual, 2008. URL http://nice.sourceforge.net/ manual.html.Google ScholarGoogle Scholar
  6. John Boyland and Giuseppe Castagna. Parasitic Methods: An implementation of multi-methods for Java. In OOPSLA, pages 66--76. ACM Press, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Kim B. Bruce, Luca Cardelli, Giuseppe Castagna, Jonathan Eifrig, Scott F. Smith, Valery Trifonov, Gary T. Leavens, and Benjamin C. Pierce. On binary methods. Theory and Practice of Object Systems, 1:221--242, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Bruno Cabral and Paulo Marques. Exception Handling: A field study in Java and .NET. In ECOOP, volume 4609, pages 151--175. Springer-Verlag, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Patrice Chalin and Perry R. James. Non-null references by default in Java: Alleviating the nullity annotation burden. In ECOOP, volume 4609, pages 227--247. Springer-Verlag, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Craig Chambers. The Diesel Language, specification and rationale, 2006. URL http://www.cs.washington.edu/research/projects/cecil/www/Release/doc-diesel-lang/diesel-spec.pdf.Google ScholarGoogle Scholar
  11. Craig Chambers. Object-oriented multi-methods in Cecil. In ECOOP, volume 615, pages 33--56. Springer-Verlag, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Craig Chambers andWeimin Chen. Efficient multiple and predicated dispatching. In OOPSLA, pages 238--255, Denver, CO, USA, 1999. ACM Press. Google ScholarGoogle Scholar
  13. Curtis Clifton, Gary T. Leavens, Craig Chambers, and Todd Millstein. MultiJava: Modular open classes and symmetric multiple dispatch for Java. In OOPSLA, pages 130--145, Minneapolis, MN, USA, 2000. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Curtis Clifton, Todd Millstein, Gary T. Leavens, and Craig Chambers. MultiJava: Design rationale, compiler implementation, and applications. TOPLAS, 28:517--575, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Antonio Cunei and Jan Vitek. PolyD: a flexible dispatching framework. In OOPSLA, pages 487--503, San Diego, CA, USA, 2005. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Edsger W. Dijkstra. Go To statement considered harmful. Communications of the ACM, 11(3):147--148, March 1968. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Christopher Dutchyn, Paul Lu, Duane Szafron, Steven Bromling, and Wade Holst. Multi-dispatch in the Java Virtual Machine: Design and implementation. In USENIX, pages 6--6, San Antonio, Texas, United States, 2001. USENIX Association. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Johan Fabry and Tom Mens. Language-independent detection of object-oriented design patterns. Computer Languages, Systems and Structures, 30(1--2):21--33, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Neal Feinberg. Dylan Programming: An Object-Oriented and Dynamic Language. Addison-Wesley, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Brian Foote, Ralph E. Johnson, and James Noble. Efficient multimethods in a single dispatch language. In ECOOP, volume 3586, pages 337--361. Springer-Verlag, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Erich Gamma, Richard Helm, Ralph E. Johnson, and John Vlissides. Design Patterns. AW, 1994.Google ScholarGoogle Scholar
  22. Joseph (Yossi) Gil and Itay Maman. Micro patterns in Java code. In OOPSLA, pages 97--116, San Diego, CA, USA, 2005. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Jeffrey Hightower. The location stack: A layered model for location in ubiquitous computing. In Proceedings of the 4th IEEE Workshop on Mobile Computing Systems & Applications (WMCSA2002), pages 22--28, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. David Hume. A Treatise of Human Nature. Printed for John Noon, London, 1739.Google ScholarGoogle Scholar
  25. Daniel H. H. Ingalls. A simple technique for handling multiple polymorphism. In OOPSLA, pages 347--349, Portland, OR, USA, 1986. ACM Press. Google ScholarGoogle Scholar
  26. Warwick Irwin. Understanding and Improving Object-Oriented Software Through Static Software Analysis. PhD thesis, University of Canterbury, Christchurch, New Zealand, 2007.Google ScholarGoogle Scholar
  27. James Kempf, Warren Harris, Roy D'Souza, and Alan Snyder. Experience with CommonLoops. In OOPSLA, pages 214--226, Orlando, FL, USA, 1987. ACM Press. Google ScholarGoogle Scholar
  28. Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Lopes, Jean-Marc Loingtier, and John Irwin. Aspectoriented programming. In ECOOP, volume 1241, pages 220--242. Springer-Verlag, 1997.Google ScholarGoogle Scholar
  29. Gregor Kiczales, Erik Hilsdale, Jim Hugunin, Mik Kersten, Jeffrey Palm, and William G. Griswold. An overview of AspectJ. In ECOOP, volume 2072, pages 327--355. Springer-Verlag, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Eric Kidd. Efficient compression of generic function dispatch tables. Technical Report TR2001-404, Hanover, NH, USA, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. David B. Lamkins and Richard P. Gabriel. Successful Lisp: How to Understand and Use Common Lisp. bookfix.com, 2005.Google ScholarGoogle Scholar
  32. Gary T. Leavens and Todd Millstein. Multiple dispatch as dispatch on tuples. In OOPSLA, pages 274--287. ACM Press, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Kin-Keung Ma and Jeffrey S. Foster. Inferring aliasing and encapsulation properties for Java. In OOPSLA, pages 423--440, Montreal, Quebec, Canada, 2007. ACM Press. Google ScholarGoogle Scholar
  34. Scott McKay and William York. Common Lisp Interface Manager: CLIM II Specification, 2001.Google ScholarGoogle Scholar
  35. Hayden Melton and Ewan Tempero. An empirical study of cycles among classes in Java. Empirical Software Engineering, 12(4): 389--415, August 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Warwick Mugridge, John Hamer, and John Hosking. Multi-methods in a statically typed programming language. In ECOOP, volume 512, pages 147--155. Springer-Verlag, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Jens Palsberg and J. Van Drunen. Visitor-oriented programming. In FOOL, Venice, Italy, 2004.Google ScholarGoogle Scholar
  38. Alex Potanin, James Noble,Marcus Frean, and Robert Biddle. Scalefree geometry in object-oriented programs. Communications of the ACM, May 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Qualitas Research Group. Qualitas corpus release 20080603. http://www.cs.auckland.ac.nz/Üewan/corpus/ The University of Auckland, June 2008.Google ScholarGoogle Scholar
  40. Lee Salzman and Jonathan Aldrich. Prototypes with multiple dispatch: An expressive and dynamic object model. In ECOOP, volume 3586, pages 312--336, Glasgow, Scotland, 2005. Springer-Verlag. Google ScholarGoogle Scholar
  41. Christopher Unkel and Monica S. Lam. Automatic inference of stationary fields: a generalization of Java's final fields. In POPL, volume 43, pages 183--195, New York, NY, USA, 2008. ACM Press. Google ScholarGoogle Scholar
  42. Philip Wadler. The expression problem. Discussion on the Java-Genericity mailing list (see 12 November 1998 post), November 1998.Google ScholarGoogle Scholar
  43. Matthias Zenger and Martin Odersky. Independently extensible solutions to the expression problem. In FOOL, San Diego, USA, October 2005. Also available as Technical Report IC/2004/109, EPFL, Switzerland, December 2004.Google ScholarGoogle Scholar

Index Terms

  1. Multiple dispatch in practice

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!