lua-users home
lua-l archive

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


2012/2/1 Leo Razoumov <slonik.az@gmail.com>:
> 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).

+1 Thank you Leo, I was thinking everyone here was approving gotos introduction.

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

I agree. I was just pointing out how illogical is in my point of view
to not introduce continue and introduce goto itself. The goto
statement present all the problems that the continue statement has and
open the way to a lot of more problems.

Francesco