BCV05 (In proceedings)
|
Author(s) | Lorenzo Bettini, Sara Capecchi and Betti Venneri |
Title | « Translating Double-Dispatch into Single-Dispatch » |
In | Proceedings of the Second Workshop on Object Oriented Developments (WOOD 2004) |
Series | ENTCS |
Volume | 138 |
Number | 2 |
Page(s) | 59-78 |
Year | 2005 |
Publisher | Elsevier |
URL | http://rap.dsi.unifi.it/~bettini/bibliography/files/doubledisp.pdf |
Abstract |
Goals of flexibility and re-usability in typed object-oriented languages suggest the requirement of double dispatch, i.e., the mechanism of dynamically selecting a method not only according to the run-time type of the receiver (single dispatch), but also to the run-time type of the argument. However, many mainstream languages, such as, e.g., C++ and Java, do not provide it, resorting to only single dispatch. In this paper we present a general technique for adding double dispatch as a type-safe language feature, so yielding dynamic overloading and covariant specialization of methods, without extending basic semantics. To this aim we introduce a toy core language, extended to a full form of (non encapsulated) multi methods. Then we define a translation algorithm from multi methods to the core language, that implements double dispatch by using only standard mechanisms of static overloading and single dispatch. As a main feature, our translation preserves type safety, it uses neither RTTI nor type downcasts and does not introduce crucial overhead during method selection. |
@inproceedings{BCV05,
number = {2},
volume = {138},
author = {Bettini, Lorenzo and Capecchi, Sara and Venneri, Betti},
series = {ENTCS},
booktitle = {Proceedings of the Second Workshop on Object Oriented
Developments (WOOD 2004)},
url = {http://rap.dsi.unifi.it/~bettini/bibliography/files/doubledisp.pdf},
title = {{Translating Double-Dispatch into Single-Dispatch}},
abstract = {Goals of flexibility and re-usability in typed object-oriented
languages suggest the requirement of double dispatch, i.e., the
mechanism of dynamically selecting a method not only according to
the run-time type of the receiver (single dispatch), but also to
the run-time type of the argument. However, many mainstream
languages, such as, e.g., C++ and Java, do not provide it,
resorting to only single dispatch. In this paper we present a
general technique for adding double dispatch as a type-safe
language feature, so yielding dynamic overloading and covariant
specialization of methods, without extending basic semantics. To
this aim we introduce a toy core language, extended to a full form
of (non encapsulated) multi methods. Then we define a translation
algorithm from multi methods to the core language, that implements
double dispatch by using only standard mechanisms of static
overloading and single dispatch. As a main feature, our
translation preserves type safety, it uses neither RTTI nor type
downcasts and does not introduce crucial overhead during method
selection.},
publisher = {Elsevier},
year = {2005},
pages = {59-78},
}
This document was generated by bib2html 3.3.
(Modified by Luca Paolini, under the GNU General Public License)
