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
Ignoring parameters
by Gaal Yahas other posts by this author
Jun 16 2005 8:56AM messages near this date
Re: scalar dereferencing. | Re: Ignoring parameters
Say I have a class method in FooClass, callable as FooClass.greet():

     method greet(Class $class: ) {
     	say "Hello, FooClass!";
     }

AFAIK, this is the only signature that would work for making &greet a
class method; but note that I'm not using $class, and I'd expect the
compiler to issue a warning in such a case.

The same problem exists with methods in classes fulfilling a role,
but which want to ignore a parameter in a required method.

What do you say about this proposed syntax?

     method greet(Class undef: ) { ... }

     # the interface calls for a "floor" as 1st arg
	 method bereaucracy(Int undef, Int $office_number) { ... }

I'm not sure how this works for named fields, but for positional ones
it should do well, and is similar to ($a, undef, $c) = LIST syntax.

-- 
Gaal Yahas <gaal@[...].org> 
http://gaal.livejournal.com/
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