develooper Front page | perl.perl6.language | Postings from March 2005

Re: MMD as an object.

Thread Previous | Thread Next
Leopold Toetsch
March 10, 2005 01:57
Re: MMD as an object.
Message ID:
Rod Adams <> wrote:
> It seems to me that there are several advantages to making a group of
> multi with the same short name a single object, of type
> MultiSub|MultiMethod, which internally holds references to the all the
> various routines that share that short name.

Discussion seems to have went off into esoteric cases of locally
overriden dispatcher policies and what not.

What I'd like to know is more basic things:

1) is there a MultiSub object with one short name that holds all
possible long names (and function references)?
If yes, who is creating it: the Perl6 compiler emits code to do so or
it's up to Parrot to do the right thing?

2) namespaces of (multi) subs.

A non-multi method is in the classes' namespace. In Parrot terms that's


I'm not quite sure, if the method hash shouldn't live inside the class.

A multi method is similar, except that their can be more then one
with the same short name (which probably means that there has to be a
MultiSub object holding the long names)

What about multi subs? They can be defined everywhere. Given:

  multi sub *foo(A $a, B $b) {...}

Is this something like:

  %globals{"foo"}  -->  MultiSub{"foo_A_B" => Sub, ...}

What about a not so global multi:

  multi sub foo(A $a, B $b) {...}

Thanks for clarifying,

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About