On Nov 19, 2007 3:11 PM, Christopher Schultz
<[EMAIL PROTECTED]> wrote:
> Nathan,
>
> Nathan Bubna wrote:
> > #foreach( $item in $loop.watch($items) )
> > $item
> > #if( $item eq 'some break condition' )$loop.break()#end
> > #end
>
> If you're going to support "break", how about supporting "continue" as
> well (restart loop from the top after iterator increment).

again, i haven't implemented this, but break would be supported by
having watch() return a custom Iterator that can be prematurely
finished.   i can't see anyway to implement "continue" without
modifying the core engine or a custom directive.

> I wonder how this would jive with nested loops. Based upon the syntax
> above, I wonder if it would be possible to break an inner loop without
> breaking the outer loop (it looks like not). While IteratorTool does not
> appear to directly support nested loops, I think such support would be a
> great goal.

i'm planning to keep references to the watched iterators in the tool
within a stack.  should make it easy to support nested loops, as
break() would just stop the iterator on top of the stack.  this might
also support a breakAll() or even allow watch($list, 'label') ->
break('label') without much effort.

> -chris
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to