Michael Lazzaro writes:
>
> On Wednesday, October 30, 2002, at 12:48 PM, Dave Storrs wrote:
> > for @a; @b -> $x is rw; $y { $x = $y[5] };
>
> I agree that it's an eyeful. How many of your issues could be solved
> if the above were just written:
>
> for (@a;@b) -> ($x is rw; $y) { $x = $y[5] };
>
>
> Would that suffice to make it clearer?
>
> MikeL
in principle , as I understand , initially the choice of single -> in
the "for" loop was because that makes it cute substitute for "sub"
and makes "for" loop (almost) a function .
But for is not a function it makes some grammar magic before "real"
work. e.g , different meaning of ";" inside closure signature .
so why not to allow it to make also special meaning of -> ? So that it
is not "exactly" sub declaration but sort of ; and then "immediate
component" ("macro" - from one of couple-of-days-ago posts of Larry Wall )
of for loop will cut and paste to reconstruct incoming
stream list and closure signature .
for @a -> $x is rw;
@b -> $y
{ $x = $y[5] };
";" between "for" and { ... } cannot be misinterpreted because parser
know it have to get to { ... } . That means for loop without block is
illegal .
and the () can be placed wherever one please here , they just mean
grouping .
aracadi