On 6/16/05, Damian Conway <[EMAIL PROTECTED]> wrote: > And I think that subs and methods *should* complain about all unused > non-optional parameters *except* invocants.
This brings up something I've been thinking about. I sometimes write a method in Perl 5 that does something or other and then calls the superclass method of the same name, passing all arguments. Or sometimes I pull off an argument or two that only make sense to my method, leaving the rest for the superclass method. This is all easy when args are just items in the @_ array. Here are some Perl 5 examples: # Do something then proceed with call "as usual" sub foo { $_[0]->do_something_new(123, 'abc'); shift->SUPER::foo(@_); } # Pull off some args, do something, then proceed with call "as usual" sub foo { my($self, %args) = @_; $self->do_something_else(val => delete $args{'xyz'}); $self->SUPER::foo(%args); } Note that in both cases my foo() method doesn't know or care what SUPER::foo()'s arguments are. 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.) -John