lua-users home
lua-l archive

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



On 09/01/2014 17:33, Jonas Thiem wrote:
The label scope (I have to admit I don't use goto or labels much)
certainly makes the goto alternative more useful. I also like the tail
recursion alternative.

Still, I would like to let you know that I would still prefer
"continue" in a few cases (mainly short loops where a separate
function with tail recursion may seem to be a bit over the top).
"continue" just seems so short and self-explanatory, and IMHO it has a
greater clarity than a goto statement where I need to check where the
jump level is at first.

I may be the only one who thinks that way. In that case, feel free to
ignore my feedback.
No, I wish continue too.
(Regarding bloat, since "goto" is already in I'd guess adding continue
will barely require much code - I may be totally wrong on this
assumption. If there is actual demand for this (that is, not just me)
I hope you would at least reconsider, even if it means a slightly
increased Lua code base.)

On Thu, Jan 9, 2014 at 1:44 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
It needs twice the lines (goto statement + label), and you need to
make up a unique jump label per loop if you got multiple loops in a
function with such a continue workaround.
Just to get the facts straight: you do not need a unique label per loop,
unless you have *nested* loops using 'continue'. Labels have block
scope, so a label inside a loop is not visible inside another
non-intersecting loop.

-- Roberto