
Jeffrey Bosboom wrote:
Edward Diener wrote:
What is a practical use for multi-methods ?
Multimethods (assuming this library uses the term as it's commonly understood) are like virtual functions that are dispatched on the dynamic types of their arguments as well as the type of *this. You can get this effect through double dispatch, but it requires a bit of plumbing and requires two virtual calls (which for some people is a large amount of overhead). (Of course, multimethods have overhead too.)
This does not explain the practical purpose of multimethods. I know what virtual functions are, of course. What in multimethods improves on the polymorphic capabilities of virtual functions that make them a practical choice for use over normal polymorphism.