```Joel VanderWerf <vjoel / PATH.Berkeley.EDU> wrote in message news:<401FFA2D.40608 / path.berkeley.edu>...
> Phil Tomson wrote:
> > Jamis Buck <jgb3 / email.byu.edu> wrote in message news:<401F1E82.1080008 / email.byu.edu>...
> >

> > Another idea would be to have a 'from (condition) to (condition)'
> > statement that looks looks like:
> >   from l=~/BEGIN/ to l=~/END/ do
> >     #do something in this range
> >   end
> >
> > Then we just need some way to determine if the range is inclusive or
> > exclusive...
> >   from l=~/BEGIN/ to l=~/END/ inclusive do
> >     puts l
> >   end
> >
> > #prints:
> > BEGIN
> >   foo
> >    bar
> > END
> >
> >   from l=~/BEGIN/ to l=~/END/ exclusive do
> >     puts l
> >   end
>
> Very readable! It may be an improvement that the flipflop isn't being
> used with if, but with a special keyword. The hidden state bothers me
> less that way. Of course you lose the possibility of a condition with
> more complex logic.

Couldn't you just use the returned FlipFlop object for those purposes?

ff = from l=~/BEGIN/ to l=~/END/ #no block passed in

then you could do things with ff:
if ff.set?
#do something
else
#do something else
end

The from (condition) to (condition) would just be syntactic sugar for
the creation of a FlipFlop object.  (kind of like [] is for Array and
{} is for Hash, or lamda is for Proc).  Come to think of it, couldn't
ff be a functional object, kind of like a closure (Proc)?  Actually,
it's probably more like a set of conditions that a Proc must evaluate
when it (the block being passed in to the from .. to .. ) is called.

....just thinking out loud.  Should probably try to prototype something
that doesn't require any syntax changes.

Phil

```