Leo~
On Wed, 19 Jan 2005 16:26:07 +0100, Leopold Toetsch <[EMAIL PROTECTED]> wrote: > [ cc'ed p6l ] > > Matt Fowles wrote: > > Leo~ > > > > On Wed, 19 Jan 2005 10:02:26 +0100, Leopold Toetsch <[EMAIL PROTECTED]> > > wrote: > > > >>But where does that PerlMMD PMC come from? Does the Perl6 compiler > >>generate one somewhere? > > > It is generated by the compiler. During compilation all of the > > different MMD functions will necessarily be parsed and compiled, when > > the first MMD function is compiled the compiler wil add a MMD PMC to > > the appropriate table. Each time a specialized version is compiled it > > will be added to the already created MMD PMC. > > Interesting. Where is this information coming from? Where can I read > more about that? The general idea that I am explain here has its root in the CLOS MMD system. To define a set of MMD methods one calls (defgeneric foo (a b c) ...) to add a particular implementation one calls (defmethod foo ((Cat a) (Monkey b) c) ...). But the crux of my idea is the following breakdown of responsibility First meta-class provides class resolution list for a particular class heirarchy (mro). This will work because the metaclass is known at class construction time and will thus know the full object heirachy for the class, objects that dynamically change their parents will go through their meta-class to do this. Second meta-methods provide the dispatch to specific multimethods based on the class resolution list (and possibly value of) their arguments. This allows different languages to provide different class resolution lists, while still enforcing a single dispatch metric for each function, but possibly different dispatch metrics for different functions with the same arguments. > >>Finding the correct MMD function is always the same algorithm. Having > >>that functionality in one place (the metaclass) is cleaner IMHO. > > > > No. It is not always the same algorithm. Perl 6 uses manhattan > > distance. > > Yes. I meant inside one class (HLL) system. The problem I see with that is calling a MMD function with arguments from two different class systems. It would make more sense to me to separate the dispatch system and the object system. The essential motivations for this is you avoid interaction of different dispatch systems (which could be quite confusing). Matt -- "Computer Science is merely the post-Turing Decline of Formal Systems Theory." -???