lua-users home
lua-l archive

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

[listproc chokes on any message that has a line starting with Version :-(
 Messages with PGP SIGNATUREs, for instance.
 Please, turn this off before posting to lua-l.  --lhf]

>From: Bennett Todd <>

2000-06-16-16:16:11 Luiz Henrique de Figueiredo:
> In 4.0 alpha we introduced "break" and labels for "break".


> We are now inclined towards removing these labels (but keeping
> "break".)

That's a shame. Either you lose the ability to break directly out of
deeply nested loops, or you have to do something sick like giving an
integer number of nesting blocks to break out of. If you do decide
to toss the labels, go ahead and lose the ability to break nested
loops; "break n" is ugly.

> Would anyone have a *good* use for labels?

Targets for break, and, if you ever should happen to want to
implement them, other irregular but often useful loop controls;
the next most useful one is called "next" in perl or "continue"
in Bourne Shell --- start the next iteration of the named loop
(immediately surrounding one by default) immediately, skipping the
remainder of the body.

The only other place I can recall using labels is awfully obscure
and probably not worth worrying about, but for a few classes of
algorithms it can be exquisitely pretty and expressive to implement
a deterministic finite state machine using a computed goto of some
species. But that probably lies outside Lua's intended domain of
application. Doing that would involve making labels a scalar data
type which can be contained in tables, and then introducing a goto
operator, whose target can be computed by a table lookup expression.

- -Bennett