Title
Open multi-methods for c++
Abstract
Multiple dispatch - the selection of a function to be invoked based on the dynamic type of two or more arguments - is a solution to several classical problems in object-oriented programming. Open multi-methods generalize multiple dispatch towards open-class extensions, which improve separation of concerns and provisions for retroactive design. We present the rationale, design, implementation, and performance of a language feature, called open multi-methods, for C++. Our open multi-methods support both repeated and virtual inheritance. Our call resolution rules generalize both virtual function dispatch and overload resolution semantics. After using all information from argument types, these rules can resolve further ambiguities by using covariant return types. Great care was taken to integrate open multi-methods with existing C++ language features and rules. We describe a model implementation and compare its performance and space requirements to existing open multi-method extensions and workaround techniques for C++. Compared to these techniques, our approach is simpler to use, catches more user mistakes, and resolves more ambiguities through link-time analysis, runs significantly faster, and requires less memory. In particular, the runtime cost of calling an open multi method is constant and less than the cost of a double dispatch (two virtual function calls). Finally, we provide a sketch of a design for open multi-methods in the presence of dynamic loading and linking of libraries.
Year
DOI
Venue
2007
10.1145/1289971.1289993
GPCE
Keywords
Field
DocType
virtual function call,open multi-method extension,virtual inheritance,open multi method,open multi-methods,multiple dispatch,virtual function dispatch,double dispatch,language feature,retroactive design,object oriented programming,c,multi methods,separation of concern,timing analysis,dynamic typing,generic programming
Double dispatch,Workaround,Programming language,Object-oriented programming,Computer science,Multiple dispatch,Separation of concerns,Theoretical computer science,Virtual function,Visitor pattern,Generic programming
Conference
Citations 
PageRank 
References 
10
0.55
13
Authors
3
Name
Order
Citations
PageRank
Peter Pirkelbauer1529.37
Yuriy Solodkyy2162.03
Bjarne Stroustrup336296.58