Realization of multimethods in single dispatch object oriented languages

  • Authors:
  • Rajeev Kumar;Vikram Agrawal;Anil Mangolia

  • Affiliations:
  • Indian Institute of Technology Kharagpur, Kharagpur, WB, India;Indian Institute of Technology Kharagpur, Kharagpur, WB, India;Indian Institute of Technology Kharagpur, Kharagpur, WB, India

  • Venue:
  • ACM SIGPLAN Notices
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

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.