skip to main content
article

Realization of multimethods in single dispatch object oriented languages

Published: 01 May 2005 Publication History

Abstract

The need for multimethods is preeminent in the domain of object-oriented programming. However, multimethods are far from universally acknowledged. Commonly used languages - C++, Java & C# - are single dispatching languages. In this paper, we demonstrate the alternatives for multimethods in such languages. The techniques discussed, in this paper, include double dispatching (a well known technique), technique of message dispatching using RTTI (explored in detail by us in this paper), and reflection (a feature provided by some compilers). We implement these techniques for C++, Java and C# languages and discuss issues associated with encapsulating multimethods in single dispatch languages. We also compare techniques in terms of their efficiency, ease of (re)use and type safety.

References

[1]
{AGS94} Amiel, E., Gruber, O., and Simon, E., "Optimizing Multi-Method Dispatch Using Compressed Dispatch Tables". In Proc. Conf. OOPSLA, pp. 244--258, Portland, OR, October 1994. Published as ACM SIGPLAN Notices, 29 (10), 1994.
[2]
{Bob+88} Bobrow, D. G., DeMichiel, L. G., Gabriel, R. P., Keene, S. E., Kiczales, G., and Moon, D. A., "Common Lisp Object System Specification X3J13". SIGPLAN Notices 2 3 (Special Issue), September 1988.
[3]
{Bud87} Budd, T. A., An introduction to object-oriented programming, 2nd Ed., Reading, MA: Addison Wesley, 1987. Understanding Object Oriented Programming with Java, Updated Ed., Reading, MA: Addison Wesley, 2000.
[4]
{Cha92} Chambers, C., "Object-Oriented Multi-methods in Cecil". In Proc. Conf. ECOOP '92, pp. 33--56, Utrecht, the Netherlands, June/July 1992.
[5]
{Cha+00} Chambers, C., Millstein, T., Clifton, C., Leavens, G. T., "MultiJava: Modular Open Classes and Symmetric Multiple Dispatch for Java". In Proc. Conf. OOPSLA, pp. 130--145, Minneapolis, Minnesota, 2000.
[6]
{Fer89} Ferber, J., "Computational Reflection in Class based Object Oriented Languages". In Proc. Conf. OOPSLA, pp. 317--326, New Orleans, Louisiana, October 1989.
[7]
{HU94} Holzle, U., and Ungar, D., "Optimizing Dynamically-Dispatched Calls with Run-Time Type Feedback". In Proc. Conf. OOPSLA, pp. 326--336, Orlando, FL, June 1994. Published as ACM SIGPLAN Notices, 29 (6), 1994.
[8]
{Ing86} Ingalls, D. H. H., "A Simple Technique for handling Multiple Polymorphism". In Proc. Conf. OOPSLA, pp.347--349, Portland, Oregon, Sep 29-Oct 02, 1986.
[9]
{KG96} Kleinöder, J., and Golm, M., "MetaJava: an Efficient Run-time Meta Architecture for Java#8482;". In Proc. Int. Workshop Object Orientation in Operating Systems (IWOOOS '96), pp. 52--61, Seattle, Washington. IEEE Computer Society Press. October 1996.
[10]
{MK00} Naik, M. and Kumar, R., "Efficient Message Dispatch in Object-Oriented Systems". ACM SIGPLAN Notices 35(3): 49--58, March 2000.
[11]
{Mae87} Maes, P., "Concepts and Experiments in Computational Reflection". In Proc. Conf. OOPSLA, pp. 147--155, Orlando, FL, Oct. 1987.
[12]
{OL03} Ortin, F., and Lovalle, J. M., "Non-Restrictive Computational Reflection". Computer Standards & Interfaces, 25(3): 241--251, June 2003.
[13]
{Smi84} Smith, B. C., "Reflection and semantics in Lisp". In Proc. Conf. POPL, pp. 23--35, ACM Press, 1984.
[14]
{Str94} Stroustrup, B., "The Design and Evolution of C++". Reading, MA: Addison Wesley, 1994.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 40, Issue 5
May 2005
47 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/1071221
Issue’s Table of Contents

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 May 2005
Published in SIGPLAN Volume 40, Issue 5

Check for updates

Author Tags

  1. message dispatch
  2. multimethods
  3. multiple dispatch
  4. object-oriented programming
  5. single dispatch

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)2
  • Downloads (Last 6 weeks)0
Reflects downloads up to 02 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2012)Space efficient non-constant time multi-method dispatch in object oriented systemsACM SIGSOFT Software Engineering Notes10.1145/2108144.210815337:2(1-6)Online publication date: 3-Apr-2012
  • (2009)Featherweight Java with dynamic and static overloadingScience of Computer Programming10.1016/j.scico.2009.01.00774:5-6(261-278)Online publication date: 1-Mar-2009
  • (2007)Making generic functions useable in SmalltalkProceedings of the 45th annual ACM Southeast Conference10.1145/1233341.1233349(36-41)Online publication date: 23-Mar-2007
  • (2007)Use of dynamically adaptive grid techniques for the solution of electrochemical kinetic equationsElectrochimica Acta10.1016/j.electacta.2006.11.00852:12(3929-3940)Online publication date: Mar-2007
  • (2007)Multiple dispatch in reflective runtime environmentComputer Languages, Systems and Structures10.1016/j.cl.2005.09.00133:2(60-78)Online publication date: 1-Jul-2007

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media