Re: Making control variables local in a loop statement

2005-01-14 Thread David Storrs
On Thu, Jan 13, 2005 at 07:35:19PM -0500, Joe Gottman wrote: In Perl5, given code like for (my $n = 0; $n 10; ++$n) {.} the control variable $n will be local to the for loop. In the equivalent Perl6 code loop my $n = 0; $n 10; ++$n {.} $n will not be local to the loop but

Re: Making control variables local in a loop statement

2005-01-14 Thread Austin Hastings
David Storrs wrote: On Thu, Jan 13, 2005 at 07:35:19PM -0500, Joe Gottman wrote: In Perl5, given code like for (my $n = 0; $n 10; ++$n) {.} the control variable $n will be local to the for loop. In the equivalent Perl6 code loop my $n = 0; $n 10; ++$n {.} $n will not be local to the

Re: Making control variables local in a loop statement

2005-01-14 Thread Matthew Walton
Austin Hastings wrote: David Storrs wrote: On Thu, Jan 13, 2005 at 07:35:19PM -0500, Joe Gottman wrote: In Perl5, given code like for (my $n = 0; $n 10; ++$n) {.} the control variable $n will be local to the for loop. In the equivalent Perl6 code loop my $n = 0; $n 10; ++$n {.} $n

Re: Making control variables local in a loop statement

2005-01-14 Thread Austin Hastings
Matthew Walton wrote: Austin Hastings wrote: But there's no clean way to make some of them temporary and some persistent. This seems like a legitimate place for saying what you intend, viz: for (my $n is longlasting = 0, $m = 1; ...) {...} Albeit that's a lame example of how to do it. What's

Re: Making control variables local in a loop statement

2005-01-14 Thread David Storrs
On Fri, Jan 14, 2005 at 02:46:58PM -0500, Austin Hastings wrote: rules, I can easily have it either way. {for (my $n=0; $n10; ++$n) {...}} # Local to loop for (my $n=0; $n10; ++$n) {...}# Persistent --Dks But there's no clean way to make some of them temporary and

Making control variables local in a loop statement

2005-01-13 Thread Joe Gottman
In Perl5, given code like for (my $n = 0; $n 10; ++$n) {.} the control variable $n will be local to the for loop. In the equivalent Perl6 code loop my $n = 0; $n 10; ++$n {.} $n will not be local to the loop but will instead persist until the end of enclosing block. It would

Re: Making control variables local in a loop statement

2005-01-13 Thread Juerd
Joe Gottman skribis 2005-01-13 19:35 (-0500): In Perl5, given code like for (my $n = 0; $n 10; ++$n) {.} the control variable $n will be local to the for loop. In the equivalent Perl6 code loop my $n = 0; $n 10; ++$n {.} $n will not be local to the loop but will instead persist

Re: Making control variables local in a loop statement

2005-01-13 Thread Luke Palmer
Joe Gottman writes: It would be nice if there were some easy way to mimic the Perl5 behavior in Perl6. In Perl6, the canonical way to make a variable local to a block is by making it a parameter. I therefore suggest allowing the following syntax: loop 0 - $n; $n 10; ++$n {...}