lua-users home
lua-l archive

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

David Kastrup wrote:
> Edgar Toernig <> writes:
> > In my experience, it helps reading and understanding code if the
> > jump-statement gives a hint about the direction the jump takes,
> > forward or backward.
> A common use case for goto is the implementation of state machines.  It
> would complicate the generation of them if you had to specify the
> direction where the label is to be found.

Hmm... for some definition of "complicate", yes.  But at the same time
you help later readers to find the target state in the code (code is
read more often then written, so time spent making reading easier pays

Well, one _could_ add a third variant to jump to nearest label
(i.e. backto/skipto/goto or goto</goto>/goto), but ...

Ciao, ET.