lua-users home
lua-l archive

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


IMO, the value of having 'continue' would be much greater than that of
this scope rule. I'd love to see canceling this rule in favor of adding
'continue'. That is, the _expression_-parameter of 'until' would resolve
its variables in the scope enclosing the repeat loop.

Honestly, the only time I missed 'continue' in Lua was the first time I tried to use it (and it was not there).
Since then I've always found 'else' + indentation a reasonable alternative. If you have too many nested scopes, you should decompose your code in subroutines anyway.
I'm a heavy C/C++ programmer (this means I'm used to 'continue') and the absence of 'continue' in Lua doesn't bother me at all. It may actually enforce good programming practices.

I also think the new scoping rule for 'repeat' is a good thing. Many times the control variable is not used anywhere else, but you'd have to declare it in the parent scope anyway. Lua allows you to 'encapsulate' this variable in the loop's scope, which is nice.

-- Thiago