:(:$x)
Does this mean a single named parameter called $x, or a default invocant
and a single required positional named $x?
--
Gaal Yahas <ga...@forum2.org>
http://gaal.livejournal.com/
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)
I was sort of assuming you could tell by a signature if it was for a
method or a sub.
"A default invocant" prolly doesn't make sense there... There's
nothing to "default" to. :-)
Audrey
Maybe methods and submethods turn
method foo ($just_a_named_param)
into
method foo ($ : $just_a_named_param)
Since we regularized invocants, there's much less need for an empty
invocant, so maybe the $ is required there if you put the :. If so, we
should probably explicitly say that there are no variables of the form
"$:", "$;", or "$,", so those will always be taken as "$ :", "$ ;", and
"$ ," respectively. At least within signatures.
In any case, prefix ':' is not an operator. In :(:$foo) the :$
starts a token, so you'd have to put space between to mean :(: $foo).
: I was sort of assuming you could tell by a signature if it was for a
: method or a sub.
I'm trying to decide if
sub ($self: $just_a_named_param)
can meaningfully put anything into $self. It seems doubtful, and it should
probably be
submethod ($self: $just_a_named_param)
So for the jet-lagged moment I think your assumption is valid. I might
jet-delag at any moment, however...
Larry
I agree. If
sub ($self: $foo)
works than it reduces privacy, since someone could call a sub like
externally, when it wasn't intended.
Mark
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