在 Sep 12, 2006 6:59 PM 時,Gaal Yahas 寫到:
What invocant is constructed in this signature then?
method foo ($just_a_named_param)
Is the signature for &foo really the same as that of bar?
sub bar ($just_a_named_param)
As Larry said, they shouldn't be the same; the first one is
&foo.signature === :($ : $just_a_named_param);
The second one is:
&bar.signature === :($just_a_named_param);
I was sort of assuming you could tell by a signature if it was for a
method or a sub.
That's correct; the "method" keyword augments the signature with an
unnamed
"$" invocant if it's not explicitly specified. (In Pugs.Val.Code
terms, that's nullID for
both the p_label slot and (v_name . p_variable).)
Cheers,
Audrey