$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [multimethods] Proposal: Open Multi-Methods
From: Jean-Louis Leroy (jl_at_[hidden])
Date: 2013-08-31 09:11:08
On 31-Aug-13 13:17, Bjorn Reese wrote:
> On 08/31/2013 01:08 PM, Edward  Diener wrote:
 >
 >> The issue seems to be to justify practical use of multi-methods
 >> over traditional OO programming with virtual functions. Remember
 >> that the latter has been the core of OO programming for decades. I
 >> do not know even how to think about designing software using
 >> multi-methods as opposed to virtual functions. Without some
 >> serious practical benefits
 >
 > The example that Alexandrescu is using in his Modern C++ Design,
 > chapter 11 on multimethods, is collision detection.
In the second article in my series on open multi-methods (to be 
published soon on Code Project), I examine another example: matrix 
addition. I also argue that open methods (multi or not, i.e. whether 
they have one virtual argument or several) are superior to virtual 
functions when it comes to modularity, extensibility and encapsulation.
A friend told me that practical applications of multi-methods are common 
in adventure game programming, where constructs like "do this to that 
with something"  abound. Languages like TADS support multi-methods for 
that purpose. See also my example (in my lib's docs) of a three argument 
method "approve(expense, role, reason)" in an expense approval system.
Finally, multi-methods are not a recent idea. They have been around for 
30 years and are available in many languages.
Jean-Louis