On Wed, May 01, 2002 at 05:08:14PM -0400, Miko O'Sullivan wrote:
> Damian said:
> > The C<BETWEEN> block can't decide whether to execute until
> > it knows whether the loop is going to iterate again. And it can't
> > know *that* until it has evaluated the condition again. At which
> > point, the $filename variable has the wrong value. :-(
> >
> > The example is a little contrived perhaps, but it might be a common
> > problem.
> 
> I don't think your example is contrived at all. It's just a situation
> where a little education is all that's needed. The rule could be quite
> simple: BETWEEN is run before every iteration except for the first
> iteration. Any variables that you use in BETWEEN are for the iteration
> that is about to run, not the iteration that just ran. Once people gt
> that concept things become clear.

You know, I almost made a very similar reply. But I read through
Damian's message a second time and changed my mind. C<BETWEEN> makes
sense as a C<NEXT> minus C<LAST>. As a C<PRE> minus C<FIRST> it's less
appealing. At the very least it begs a different name than "BETWEEN" (a
name that implies it executes "between" each loop, not at the beginning
of some).

Hmmm... would C<LAST> not have the same problem as C<BETWEEN>? It also
"can't decide whether to execute until it knows whether the loop is
going to iterate again". 

Allison

Reply via email to