lua-users home
lua-l archive

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

Rici Lake wrote:
Indeed it does. But in C, the following is illegal:

do {
  int i = 1;
  // ...
} while(i);

(Or, at least, it refers to a different 'i' than was declared inside the loop.) So any 'continue' is in fact jumping to the end of the scope, and then executing the test in the surrounding scope.

I'm not suggesting that it was a bad thing to change the scope of 'until': Diego has a good point about its utility. And Lua does not have a 'continue' statement, so the discussion about what its semantics might be is completely hypothetical, which doesn't make it less interesting :)

Not to mean any disrespect to the great designers of Lua, but the designers of C certainly thought about this long and hard and made the decision to keep it out of the inner scope, probably for exactly this reason. So following that wisdom might be a good choice.

While Lua does not have this problem because it does not currently have a continue statement, I think it would be tragic if this feature were kept out of future revisions because of this choice.

I can make a good argument for keeping the control expression out of the inner scope of repeat, in that the control expression of the while statement is also out of this scope. So for consistency, and for the future inclusion of the extremely important continue statement, I really think repeat should changed back to the way it was!

Just my stinkin' opinion :-)

chris marrin              ,""$, "As a general rule,don't solve puzzles        b`    $  that open portals to Hell" ,,.
        ,.`           ,b`    ,`                            , 1$'
     ,|`             mP    ,`                              :$$'     ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`