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

Re: MMD as an object.

Thread Previous | Thread Next
From:
Leopold Toetsch
Date:
March 10, 2005 01:57
Subject:
Re: MMD as an object.
Message ID:
200503100953.j2A9rBF18302@thu8.leo.home
Rod Adams <rod@rodadams.net> 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
currently:

  %globals{"\0class_name"}{"method_name"}

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,
leo

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About