[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: upcoming changes in Lua 5.2 [was Re: Location of a package]
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 25 Feb 2008 09:28:02 -0300
> 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