Re: Exiting multiple loop constructs
Jason Gade wrote:
>
> My only real concern is the placement of the "label" statement. Not sure where
> it should go to be most clear.
>
> I don't like the "all" option, you should know the label of the highest level
> you are exiting. No need for a predefined label, IMO.
>
> I'm not sure what kinds of stack cleanup/unwinding would need to be done in
> order to prevent memory/resource leaks and/or fill up the interpreter's stack
> with data from exited loops.
>
> --
> A complex system that works is invariably found to have evolved from a simple
> system that works.
> --John Gall's 15th law of Systemantics.
>
> "Premature optimization is the root of all evil in programming."
> --C.A.R. Hoare
>
> j.
None.
The parser doesn't exit your loops, ig plows sequentially through them. There is
a stack of requested exits, and, at each end for/end while, they are examined,
and thoe who are ripe get backpatched appropriately. The stack grows when an exit
statement is met, and shrinks when all end exit requests are marked as processed.
At least that's how I implemented it.
So, there is a stack,, but it dosn't grow larger than the deepest loop nesting
level in program. Stack overflow is very unlikely.
CChris
|
Not Categorized, Please Help
|
|