[MUD-Dev] TECH: programming languages (was: Re: TECH: STL / Heaps, etc.)

Bruce Mitchener bruce at puremagic.com
Thu Aug 16 08:47:42 New Zealand Standard Time 2001

Federico Di Gregorio wrote:
> On 07 Aug 2001 10:31:30 -0600, Bruce Mitchener wrote:

>>  * Has anyone looked at using alternative method dispatch
>>  mechanisms, like predicate dispatch to simplify the
>>  implementation? (Predicate dispatch systems would be interesting
>>  to see used as the basis for an event system.)

> i don't know what you mean by "alternative method dispatch" but
> with i wrote aedon (http://initd.org/Software/aedon/) exactly to
> experiment with a different method to 'dispatch' actions on
> objects using a very bacic kind of fuzzy logic. see also the
> posting with subject "The Aedon rule system" on this list, some
> months ago.

Multiple dispatch is when the runtime (or compiler) looks up the
method based on the types of all of the arguments, not just the
receiving class.

Dylan, CLOS and other systems use multiple dispatch:


Or Perl:


Or, more generally:


Predicate dispatch is a more general form of multiple dispatch and
looks at more than just the types of the args:

  From http://sdg.lcs.mit.edu/~mernst/pubs/gud-ecoop98-abstract.html:

     Predicate dispatching generalizes previous method
     dispatch mechanisms by permitting arbitrary
     predicates to control method applicability and by
     using logical implication between predicates as the
     overriding relationship. The method selected to
     handle a message send can depend not just on the
     classes of the arguments, as in ordinary object-
     oriented dispatch, but also on the classes of
     subcomponents, on an argument's state, and on
     relationships between objects. This simple
     mechanism subsumes and extends object-oriented
     single and multiple dispatch, ML-style pattern
     matching, predicate classes, and classifiers,
     which can all be regarded as syntactic sugar
     for predicate dispatching. This paper introduces
     predicate dispatching, gives motivating examples,
     and presents its static and dynamic semantics. An
     implementation of predicate dispatching is available.

Work on efficiently implementing predicate dispatch:


An interesting project that makes use of much of this is the Dynamic
Domain Architectures work:


After all that ....

I think that predicate dispatch would be a very interesting approach
to writing some event dispatch code for handling resolution of
actions within the world, which -are- dependent upon a number of
factors and where it is desirable to be able to override behaviors
in a straightforward manner.

  - Bruce

MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list