lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Mark Hamburg <mark@grubmah.com> writes:

> If one must have continue, and I will admit to missing it fairly routinely in some code, then there are a couple of simple options with respect to the scope rule:
>
> 1. Disallow continue when the innermost loop is a repeat/until loop.
> 2. Disallow access to variables defined inside the loop in the condition portion of a repeat/until that also includes a continue statement.

What about

3. continue means to restart iteration at the top even in repeat-until,
   unlike C's behavior.

In that way, the scope of the condition is irrelevant.  If you think
that this might confuse C users, call it "reloop" or "reiterate" or
"loop" or whatever instead of "continue".

I think that behavior would be more useful anyway.  "continue" implies
restarting some loop in a short circuit, and the whole point of
repeat..until is that the condition is only fully established once you
have completed the body, so the short circuit way is not likely to have
established all the material for a useful evaluation of the loop
condition, anyway.

-- 
David Kastrup