On Fri, Jun 17, 2005 at 08:13:55AM +1000, Damian Conway wrote:
> Patrick wrote:
> > method greet(FooClass $class:) { say "Hello!"; }
>
> No. That needs to be:
>
> method greet(FooClass ::class:) { say "Hello!"; }
>
> (as implied by "takes a class as its invocant" in S12).
Okay, I'm a bit confused. I understand why the one I wrote above is
incorrect -- silly me. But I'm having trouble with the syntactical
parsing of the parameter list of the second, and I can't find any
references or similar cases in S12/A12/S06/A06. Is '::' acting as a
sigil here?
More to the point, I'm having trouble meshing this with the rules for
parameters listed in A06 (fully recognizing that there may be
"correcter" forms of A06-- I'm just trying to find what the correcter
form is ... :-). From A06, with an updated "rule sigil" for
private attributes and pod....
Here's what an individual parameter looks like:
rule parameter :w {
[ <type>? <zone>? <variable> <trait>* <defval>?
| \[ <signature> \] # treat single array ref as an arg list
]
}
rule zone { <[?*+]> }
rule variable { <sigil> <name> [ \( <siglet> \) ]? }
rule sigil { <[EMAIL PROTECTED]&]> <[*.:?^=]>? }
I'm missing something fundamental in getting
method greet(FooClass ::class:) { say "Hello!"; }
to parse.
Pm