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 Luke Palmer other posts by this author
Jun 16 2005 12:26PM messages near this date
Ignoring parameters | Re: Ignoring parameters
On 6/16/05, Gaal Yahas <gaal@[...].org>  wrote:
>  Say I have a class method in FooClass, callable as FooClass.greet():
>  
>       method greet(Class $class: ) {
>          say "Hello, FooClass!";
>       }

Aside from the fact that I don't think this is the right way to
specify class methods...

>  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.

I don't think that the compiler should issue a warning in the case of
unused parameters.  Since the names of parameters mean something more
than just how the method refers to them--they specify the names of
named parameters--it could be useful to accept a parameter that is not
used, in anticipation of them eventually being used.  The "unused
parameter" warning has never caught an error that "undeclared
variable" hasn't for me (as long as I name things well), and usually
is just a cue to bring out my UNUSED fingers.

>  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: ) { ... }

Or we could finally take an idea from C++, one that I don't think is
so unreasonable:

    method greet(Class:) {...}

Since there is no :: on the front of Class, it can't be mistaken for a
parameter.  That does bring up the question of what happens if you
want to specify an indirect type as the type of a parameter.  Maybe we
just disallow that...

Luke
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