[EMAIL PROTECTED] wrote:
Ok. If you'd really need such random dispatch, it could be done like
this, when I interpret A12 correctly:
sub run_random_bar($x) {
my @meths = WALKMETH($x, :method('bar'));
my $meth = @meths[rand(@meths.elems)];
$meth($x);
}
or even with
my sub bar($x) {...}
Leopold Toetsch wrote:
Rod Adams <[EMAIL PROTECTED]> 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
Rod Adams <[EMAIL PROTECTED]> wrote:
> Leopold Toetsch wrote:
>>Discussion seems to have went off into esoteric cases of locally
>>overriden dispatcher policies and what not.
> I don't think it's as esoteric as you might think. Consider:
> package Foo;
> use MMD::Random;
> our &bar
Bob Rogers <[EMAIL PROTECTED]> wrote:
>From: Leopold Toetsch <[EMAIL PROTECTED]>
>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
From: Leopold Toetsch <[EMAIL PROTECTED]>
Date: Thu, 10 Mar 2005 10:53:11 +0100
Rod Adams <[EMAIL PROTECTED]> 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 int
[EMAIL PROTECTED] wrote:
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
Uh
Rod Adams <[EMAIL PROTECTED]> 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