Damian Conway skribis 2005-05-16 10:33 (+1000):
> This missing design rationale here is that the colon acts as part of the
> unary operator:
> ./ unary public-method-call-on-invocant
> .: unary private-method-call-on-invocant
> So the rule is:
> One-character operator --> call on $_
> Two-character operator --> call on $?SELF"
I was very specific about ./ being prefix only. Aligning it with .: is
ugly, because .: can be used infix.
$object.method
$object.:method
given $object {
.method
.:method # !!
}
Either it should do the expected thing, default to $_, or one of .:'s
syntaxes must be made invalid. Don't try to convince me that prefix .:
is an entirely different operator, because it is spelled the same and
does the same thing (call a private method). The only thing that's
different is that its invocant is left out of the code, and when we then
use something that isn't there, we call that a default. And defaults are
always $_, never $?SELF. But that you know.
Anything that begins with a dot looks way too much like the lone dot to
subtly mean something else.
Either infix .: must go away, or prefix .: must operate on $_.
I think infix .: can go, because calling private methods should be
harder anyway. Make that $object.!!(:)method for all I care.
And I think "method :name" must be very differently spelled, because it
looks like : is part of the name, which makes me want consistency:
$o.private $.private .private ./private
$o.:private $.:private .:private ./:private
Even forcing whitespace between : and name would already solve this:
"method : name". It's ugly though.
To be honest, the current fog around private methods, and my not liking
much of the way they work, is pushing me towards good old _private
instead, ignoring the whole wildly special cased colon method thingies.
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html