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 "visitor" pattern. We describe a new, simple, and orthogonal way to add multimethods to single-dispatch object-oriented languages, without affecting existing code. The new mechanism also clarifies many differences between single and multiple dispatch. tuple gives multiple dispatch. To illustrate the idea, we have designed a simple class-based 00 language called Tuple*. While perhaps not as elegant as a language built directly with multiple dispatch, we claim the following advantages for our mechanism: 1. It can be added to existing single dispatch languages, such as C++ and Java, without affecting either (a) the semantics or (b) the typing of existing programs written in these languages. Multiple dispatch, multimethods, generic functions, typing, single dispatch, binary methods, semantics, language design, Tuple. 3. It is simple enough to be easily understood and remembered, we believe, by programmers familiar with standard single dispatch.
Tuple REF is a simple object-oriented language designed to integrate dynamic overloading in a language by adding tuples as primitive expressions.
Multiple dispatch as dispatch on Tuples
OOPSLA '98
Computer Science