lua-users home
lua-l archive

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

Am 02.07.2014 23:14 schröbte Paige DePol:
On Jul 2, 2014, at 8:56 AM, Dirk Laurie <> wrote:

2014-07-02 13:51 GMT+02:00 David Demelier <>:

I don't know any other language that use goto continue or goto break to
control the loop, it's just a bloody idea.

Lua 5.2 uses "goto continue" if you want to, and implicitly translates
"break" to "goto break" whether you want to or not. The opportunity
to provide a "continue" keyword in Lua 5.3 seems not to have been

So basically my post says: if you can't beat them, join them.
If you are forced to type "goto continue", at least be spared
the trouble of inserting ::continue::. It *is* just an idea.

If you are going to hack your copy of Lua to implicitly add a `continue` label then why wouldn't you just add the `continue` keyword and save the ugliness that is `goto continue`?

Apparently there already is a hidden `break` label, and substituting the `break` statement with `goto break` would replace an ad-hoc convenience feature with a more basic mechanism (which seems very Lua-like, IMHO), freeing a keyword in the process. As a bonus one could easily add other predefined labels like the often requested `continue`, `redo` (as in perl), and possibly others, without any new keywords. We probably should talk about reserved label names though ...

But the fact that no other language uses it, if true, makes me like
it better, not less.

Uh... okay. That is kind of weird, you know! ;)

It wouldn't be the only unique feature of Lua, and so far most of those turned out ok.