Leavens, Gary T. and Millstein, Todd D. (1998) Multiple Dispatch as Dispatch on Tuples. Technical Report TR98-03b, Department of Computer Science, Iowa State University.
Multiple Dispatch as Dispatch on Tuples
Gary T. Leavens and Todd D. Millstein
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.
Keywords: Multimethods, generic functions, object-oriented programming
languages, single dispatch, multiple dispatch, tuples, product types,
encapsulation, modularity, static typechecking, subtyping,
inheritance, Tuple language.
1998 CR Categories:
D.3.1 [Programming Languages] Formal Definitions and Theory --- Semantics;
D.3.2 [Programming Languages] Language Classifications ---
D.3.3 [Programming Languages] Language Constructs and Features ---
Abstract data types, control structures, procedures, functions, and
D.3.m [Programming Languages] Miscellaneous --- multimethods,
generic functions, single dispatch, multiple dispatch, type systems;
F.3.3 [Logics and Meanings of Programs] Studies of Program Constructs ---
control primitives, type structures.
Copyright (c) 1998 by the Association for Computing Machinery,
Inc. Permission to make digital or hard copies of part or all of this
work for personal or classroom use is granted without fee provided
that copies are not made or distributed for profit or commercial
advantage and that new copies bear this notice and the full citation
on the first page. Copyrights for components of this work owned by
others than ACM must be honored. Abstracting with credit is
permitted. To copy otherwise, to republish, to post on servers, or to
redistribute to lists, requires prior specific permission and/or a
Contact site administrator at: email@example.com