From: Christoph Date: 2002-09-27T01:35:16+09:00 Subject: Re: adding overload to ruby "William Djaja Tjokroaminata" wrote in message news:amv8tt$agp$1@grapevine.wam.umd.edu... > Hi, > > I agree, but we have to be careful about the consequence of > multi-dispatch. In C++, this was accomplised using name mangling of the > function; hopefully this needs not happen in Ruby. But still, I think we > need to deal with how to resolve ambiguities in multi-dispatch, which I > think in C++, being a typed language, was complicated enough. As far as I know there are essentially four possible ways to do this a). Some muddled C++ convention b) CLOS way - Use the lexicographic or similar order (for example a mixture of path length + lexicographic order) on the multi-dispatch argument types to determine the best (closest) match. This is fairly unnatural imo. c) Determine if a ``most specific '' specialization on argument type (+ self type) exists. In case of ambiguities call a method like ambiguous_method_call . (default action is to raise an Exception) . This is Cecil's and Dylan's way I believe. d) (A combination of b & c). Similar to c) but instead of raising an exception in the presence of ambiguities choose the lexicographic largest (or largest in another good total order) among the ``most specific type specializations. e) Maybe a combination of c) & d) Personally I would probably go with d) /Christoph