Re: Ignoring parameters
by Patrick R. Michaud other posts by this author
Jun 16 2005 2:33PM messages near this date
Re: Ignoring parameters
|
Re: Ignoring parameters
On Fri, Jun 17, 2005 at 07:05:11AM +1000, Damian Conway wrote:
> Gaal Yahas wrote:
> >On Thu, Jun 16, 2005 at 01:26:31PM -0600, Luke Palmer 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...
> >
> >What do you think is the right way to specify them?
>
> I certainly can't speak for Luke, but I think the right way to specify
> class methods is:
>
> method greet(FooClass ::class:) {
> say "Hello, FooClass!";
> }
In the interest of keeping the design documents up-to-date, A12 says:
To declare an ordinary class method, such as a constructor, you say
something like:
method new (Class $class: *@args) { ... }
Such a method may only be called with an invocant that "isa" C<Class> ,
that is, an object of type C<Class> , or derived from type C<Class>.
S12 says:
Class methods are just methods that can take a class as their invocant.
Somehow I read these as though the original poster was correct --
i.e., one creates a class method for FooClass as either
method greet(Class $class:) { say "Hello!"; }
or
method greet(FooClass $class:) { say "Hello!"; }
Are the design documents out of date in this regard? If so, can
someone provide a patch, if not, can someone confirm that the design
documents are correct? (I just happened to be looking at class methods
this past week, which is why I was a little surprised by Luke and
Damian's answers... :-)
Pm
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
|