On Thu, Jun 16, 2005 at 05:18:51PM -0400, John Siracusa wrote:
: Now in Perl 6 I'll want to use fancy named parameters and so on, but I don't
: want to lose the abilities described above. How would those examples look
: in "native" Perl 6 code? (i.e., Without forcing all methods to have a
: single slurpy [EMAIL PROTECTED] argument, emulating the Perl 5 mechanisms.)
Something like:
# Do something then proceed with call "as usual"
method foo ([EMAIL PROTECTED])
{
./do_something_new(123, 'abc');
./SUPER::foo(@args);
}
# Pull off some args, do something, then proceed with call "as usual"
method foo ()
{
./do_something_else(val => delete %_<xyz>);
./SUPER::foo(%_);
}
All methods get a slurpy %_ unless you declare your own. But you probably
want to avoid "super" semantics and write that:
method foo ()
{
./do_something_else(val => %_<xyz>);
next;
}
I've also taken the liberty of deleting your delete, on the assumption
that your "next" method might want to see the same argument and do
something else with it. A set of "next" methods need a consistent
parameter namespace in any event, so there's no harm in leaving the
parameter in %_, and some performance benefit in not doing something
better performed by GC (we hope).
Larry