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 not clean about

{
  loop my $n = 0; $n < 10; $n++ {
    ...
  }
}

? Works fine for me, shows the scope boundaries very clearly indeed, just the kind of thing a lot of languages are missing, IMO.

Of course, this example's really bad because it's much better written

for 0..9 {
  ...
}

In which case I assume that it only clobbers the topic inside the block, not outside it, as it's somewhat like

for 0..9 -> $_ {
  ...
}

To write it explicitly. Or am I barking up the wrong tree completely?

Not sure. In my example, there were two variables, 'n' and 'm', one of which was supposed to outlast the scope, the other not.

=Austin




-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 1/10/2005



Reply via email to