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.
- 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 Scholar
- Daniel G. Bobrow. The LOOPS Manual. Xerox Parc, 1983.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Daniel Bonniot, Bryn Keller, and Francis Barber. The Nice user's manual, 2008. URL http://nice.sourceforge.net/ manual.html.Google Scholar
- John Boyland and Giuseppe Castagna. Parasitic Methods: An implementation of multi-methods for Java. In OOPSLA, pages 66--76. ACM Press, 1997. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- Craig Chambers. Object-oriented multi-methods in Cecil. In ECOOP, volume 615, pages 33--56. Springer-Verlag, 1992. Google Scholar
Digital Library
- Craig Chambers andWeimin Chen. Efficient multiple and predicated dispatching. In OOPSLA, pages 238--255, Denver, CO, USA, 1999. ACM Press. Google Scholar
- 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 Scholar
Digital Library
- Curtis Clifton, Todd Millstein, Gary T. Leavens, and Craig Chambers. MultiJava: Design rationale, compiler implementation, and applications. TOPLAS, 28:517--575, 2006. Google Scholar
Digital Library
- Antonio Cunei and Jan Vitek. PolyD: a flexible dispatching framework. In OOPSLA, pages 487--503, San Diego, CA, USA, 2005. ACM Press. Google Scholar
Digital Library
- Edsger W. Dijkstra. Go To statement considered harmful. Communications of the ACM, 11(3):147--148, March 1968. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Neal Feinberg. Dylan Programming: An Object-Oriented and Dynamic Language. Addison-Wesley, 1997. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Erich Gamma, Richard Helm, Ralph E. Johnson, and John Vlissides. Design Patterns. AW, 1994.Google Scholar
- Joseph (Yossi) Gil and Itay Maman. Micro patterns in Java code. In OOPSLA, pages 97--116, San Diego, CA, USA, 2005. ACM Press. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- David Hume. A Treatise of Human Nature. Printed for John Noon, London, 1739.Google Scholar
- Daniel H. H. Ingalls. A simple technique for handling multiple polymorphism. In OOPSLA, pages 347--349, Portland, OR, USA, 1986. ACM Press. Google Scholar
- Warwick Irwin. Understanding and Improving Object-Oriented Software Through Static Software Analysis. PhD thesis, University of Canterbury, Christchurch, New Zealand, 2007.Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- Eric Kidd. Efficient compression of generic function dispatch tables. Technical Report TR2001-404, Hanover, NH, USA, 2001. Google Scholar
Digital Library
- David B. Lamkins and Richard P. Gabriel. Successful Lisp: How to Understand and Use Common Lisp. bookfix.com, 2005.Google Scholar
- Gary T. Leavens and Todd Millstein. Multiple dispatch as dispatch on tuples. In OOPSLA, pages 274--287. ACM Press, 1998. Google Scholar
Digital Library
- 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 Scholar
- Scott McKay and William York. Common Lisp Interface Manager: CLIM II Specification, 2001.Google Scholar
- Hayden Melton and Ewan Tempero. An empirical study of cycles among classes in Java. Empirical Software Engineering, 12(4): 389--415, August 2007. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Jens Palsberg and J. Van Drunen. Visitor-oriented programming. In FOOL, Venice, Italy, 2004.Google Scholar
- Alex Potanin, James Noble,Marcus Frean, and Robert Biddle. Scalefree geometry in object-oriented programs. Communications of the ACM, May 2005. Google Scholar
Digital Library
- Qualitas Research Group. Qualitas corpus release 20080603. http://www.cs.auckland.ac.nz/Üewan/corpus/ The University of Auckland, June 2008.Google Scholar
- 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 Scholar
- 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 Scholar
- Philip Wadler. The expression problem. Discussion on the Java-Genericity mailing list (see 12 November 1998 post), November 1998.Google Scholar
- 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 Scholar
Index Terms
Multiple dispatch in practice
Recommendations
Multiple dispatch in practice
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 ...
Multiple dispatch as dispatch on Tuples
OOPSLA '98: Proceedings of the 13th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applicationsMany popular object-oriented programming languages, such as C++, Smalltalk-80, Java, and Eiffel, do not support multiple dispatch. Yet without multiple dispatch, programmers find it difficult to express binary methods and design patterns such as the "...
Multiple dispatch as dispatch on Tuples
Many popular object-oriented programming languages, such as C++, Smalltalk-80, Java, and Eiffel, do not support multiple dispatch. Yet without multiple dispatch, programmers find it difficult to express binary methods and design patterns such as the "...







Comments