On Fri, 18 Mar 2005 09:45:57 -0800, Larry Wall wrote:
> I think we'll need to figure out how to shorten $_.foo instead.

It looks short enough to me already. More importantly, its meaning
is immediately obvious.

> Either that, or there has to be a way to explicitly make $_ the
> invocant of a subblock.

How about something like this?

  method foo{
    .bar; # Acts on self
    for @stuff {
      .bar; # Acts on self
    }
    for @stuff -> $_ :self {
      .bar; # Acts on self, which is currently $_
    }
  }

Seems like overkill for trivial blocks though:

  map -> $_ :self { .bar } 1..10;

but you can still just write $_.bar

Maybe we could allow $_ to be elided?

  map -> :self { .bar } 1..10;


> At the moment I'm trying to see if I could get used to ..method
> meaning $_.method, and whether it buys me anything psychologically.

I still prefer $_.method


> Suppose you are one of those rare people who actually checks the
> return value of print to see if you filled up the disk:
>
>     if print {...}
>
> That doesn't parse currently ... (Backtracking the parser is
> probably not the right answer.)

If you're going to the trouble to check that (which I do,
sometimes), surely two extra characters [$_ or ()] aren't that
much of a problem? You probably wouldn't be using implicit
variables, anyway.

A backtracking parser seems pretty scary to me. If it takes a lot of
work for the compiler to figure things out, it's going to be even
harder for the programmer.

-- 
        Peter Haworth   [EMAIL PROTECTED]
"I think this is one of those traumatic things eggs have to face
 to prepare a good omelette."
                -- Jarkko Hietaniemi

Reply via email to