At 07:57 AM 04-03-2002 -0800, Larry Wall wrote:
>Mark J. Reed writes:
>: loop (my $i=0; 1; $i++) {
>: </exegesis4>
>
>No, the scope of $i stays outside, per the previous decision. If you
>want it inside you can always make $i an official formal parameter:
>
> for 0 .. Inf -> $i { ... }
>
>I think that better documents a counted infinite loop in any case.
Hmmm, in the more general case of:
for (my $i = intializer(); condition($i); $i = advance($i)) { ... }
where you might want $i to be lexically scoped in the for loop, is there a
way to do it?
Perhaps something like:
initalizer() -> $i { LOOP: NEXT { $i = advance($i); redo LOOP if
condition($i);} ... }
except I'm not sure that that would have the same semantics.
(Or, more generally, given a for loop with a "my", how sould perl52perl6
deal with it?
>Larry