lua-users home
lua-l archive

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


On Wed, Feb 1, 2012 at 06:16, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> Not so.  The scope of the local stops just before the `::a::`, because a
> label is a void statement. The manual is clear on this point, as Xavier Wang
> has pointed out in the thread on "Clarification on goto scope".
>

IMHO, potentially scope violating jumps like goto should be avoided
like a plague.
We can argue all day long about label placement in 5-lines long code
snippets. In a real world project that choose to allow gotos a
programmer will be navigating a mine field scanning surrounding code
for labels and gotos each time before declaring a new local variable.
Otherwise, hard-to-find bugs will be inevitably introduced. Goto based
state-machines is a niche market. Is it really worth while making
everyone else's life more difficult? Besides, if one really needs a
fast-efficient state machine one can implement it in plain C and bind
it to Lua or LuaJIT (FFI will greatly help).

Francesco is right on point. Where did all the "continue" criticism
disappear? goto has all the continue problems plus more.

--Leo--