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: [EMAIL PROTECTED]) { ... }
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