Multiple dispatch again

Bruce Hoult bruce at hoult.org
Thu Jan 2 14:40:47 EST 2003


In article <3e14589e_5 at news.bluewin.ch>,
 "Samuele Pedroni" <pedronis at bluewin.ch> wrote:

> > As well, I decided to make dispatch resolution order configurable.
> > Hochberg's example was perhaps naive in fixing resolution order
> > according to definition order.  That seems a little fussier than I would
> > want.  So I made that configurable as well, and provide four sample
> > resolution functions.  Two are naively definition-order based (either
> > forward or reversed).  But two others are perhaps better candidates:
> > 'lexicographic_mro()' and 'weighted_mro()'.  If I understand correctly
> > (which I may not), the first follows Dylan, the second follows Damian
> > Conway' Class::Multimethods.  I would be interested to understand other
> > examples, particularly CLOS.  I have little intuition about what is the
> > "right" answer.
> 
> lexicographic is default CLOS approach, in Dylan:
> 
> given B isa A,  then the signatures
> 
> (B,A)
> (A,B)
> 
> would be ambiguous. (but if I recall correctly some(one) Dylan impl use the
> CLOS ordering and not the Dylan one, oh well).

Functional Objects' Dylan system started with a lot of code that is 
based closely on libraries from CLOS and depends ont the CLOS ordering.  
I think they try to use the Dylan ordering, and if it ambiguous then 
they fall back to CLOS.

-- Bruce




More information about the Python-list mailing list