Larry Wall wrote:
> : Is it forbidden to use placeholder parameters in conjunction with
> : "my"?  Or would it simply not do anything useful?  I ask because "Do
> : what I mean" would seem to imply that 'my Dog $^foo' would specify
> : $^foo's type as 'Dog'.  Though if you start doing too much of that,
> : you're almost certainly better off explicitly defining a signature.
> Indeed.

So we're agreed that it could be abused if permitted.  Still, is it permitted?

> : Also, how much trouble would we get in if we spelled the ubiquitous
> : alias for a method's invocant as C< $^_ > instead of C< $self >?
> Then we're back to confusing people over the difference between the
> object and the topic, and the topic-as-self breaks as soon as you
> topicalize some other way.  And you can always throw in a "$_ := self"
> or a "given self" if you really want it.  Plus $.foo is still only
> one character longer than .foo so it doesn't really get you much most
> of the time.

Huh.  My intention was not to topicalize the invocant.  Rather, I
thought that $_ and $^_ would be treated as two separate variables: $_
would be the topic, while $^_ would be the invocant.  I'm trying to
think of why this distinction might not be.

Unless I'm missing something, it would be very much like what we have
now, except that '$self' would be spelled '$^_' (shorter and not tied
to English, but instead evocative of "I'm using a parameter that I may
not have declared in the signature, sort of like what placeholder
parameters do" and "I'm using the parameter that defines what this
routine is talking about, sort of like what the topic variable does").

Jonathan "Dataweaver" Lang

Reply via email to