lua-users home
lua-l archive

Re: upcoming changes in Lua 5.2 [was Re: Location of a package]

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


For me 'continue' is such a nagging omission too...
This could be resolved by requiring the 'until' expression to be valid (and *identical*
in terms of variable identity) in all scopes where a 'continue' is present.
ie. require declarations of all used variables above the first 'continue'
/Flemming
Roberto Ierusalimschy wrote:
I'm upset to find that adding 'continue' is not even being considered.
(Just to let you know that there still are ones that miss it).
Here is a fine example of hiden costs of features.
In Lua 5.1, we changed the scope rules for repeat-until, so that the
test is included in the scope of the body. That seemed a nice and
innocent feature, allowing code like this:
 repeat
 ...
 local x = ...
 ...
 until something-with-x
Of course this change would cause no harm...
Now, consider the addition of 'continue':
 repeat
 ...
 if something then continue end
 ...
 local x = ...
 ...
 until something-with-x
We have two options: either the continue jumps into the scope of 'x'
bypassing its declaration/initialization (very bad), or the continue
skips the test altogether (very bad too).
So, it seems that continue is incompatible with this scope rule...
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /