ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Re: Ignoring parameters
by Larry Wall other posts by this author
Jun 17 2005 12:16PM messages near this date
Re: Ignoring parameters | Re: Ignoring parameters
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 *@args argument, emulating the Perl 5 mechanisms.)

Something like:

    # Do something then proceed with call "as usual"
    method foo (*@args)
    {
      ./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
Thread:
Gaal Yahas
Luke Palmer
John Siracusa
Damian Conway
John Siracusa
David Storrs
Matthew Zimmerman
Juerd
Matthew Zimmerman
Damian Conway
David Storrs
Juerd
Kurt
Jonathan Scott Duff
Juerd
Juerd
Kurt
Juerd
John Siracusa
John Siracusa
Adam Kennedy
Juerd
John Siracusa
Adam Kennedy
John Siracusa
Darren Duncan
John Siracusa
Juerd
Juerd
Darren Duncan
John Siracusa
John Siracusa
John Siracusa
Damian Conway
Abhijit Mahabal
Damian Conway
Patrick R. Michaud
John Siracusa
Larry Wall
Gaal Yahas
Damian Conway
Patrick R. Michaud
Damian Conway
Patrick R. Michaud
Larry Wall
Patrick R. Michaud
"TSa (Thomas Sandlaß)"
Larry Wall

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved