Re: Anonymous multi-subs

2015-06-25 Thread yary
On Wed, Jun 24, 2015 at 7:17 PM, Brent Laabs wrote: I'll just note that you can fake anon multi subs with lexical subs like this: my $sub = do { proto foo (|) { * } multi foo (Int $x) { $x + 1 } multi foo (Str $y) { $y ~ 'a' } &foo; } say $sub("hello"); I like that, and I suspe

Re: Anonymous multi-subs

2015-06-24 Thread Brent Laabs
I'll just note that you can fake anon multi subs with lexical subs like this: my $sub = do { proto foo (|) { * } multi foo (Int $x) { $x + 1 } multi foo (Str $y) { $y ~ 'a' } &foo; } say $sub("hello"); The sub there is still named "foo" as attested by $sub.name, but isn't availa

Re: Anonymous multi-subs

2015-06-24 Thread Jon Lang
On Wednesday, June 24, 2015, yary wrote: > Now that I've thought about it for 90 seconds (not fully-formed idea), if > one were to have an anonymous multi-sub, it ought to be constructed from a > list of *signature*, *body *pairs. > > And/or, any non-finalized sub could have a method to add anoth

Anonymous multi-subs

2015-06-24 Thread yary
Now that I've thought about it for 90 seconds (not fully-formed idea), if one were to have an anonymous multi-sub, it ought to be constructed from a list of *signature*, *body *pairs. And/or, any non-finalized sub could have a method to add another *signature, body* to its dispatch list. apologie