lua-users home
lua-l archive

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

The difference would be that the behaviour of continue is well defined where as use of goto tends to lead to spaghetti code and it's not really clear how it's supposed to work. Which is the reason why languages like Java etc avoid it. If you have a complex problem that benefits from solving it in a "spaghetti" way then I guess you could like this addition but I'm not sure what the use cases motivating this addition are?

I do use break, and occasionally continue where it makes sense, but personally I last used a goto statement, literally, in the 80's on a c64. There is no way I will start using it as a replacement for continue, I'll just continue to write around the problem instead.

You say "we did not see why to include this one without including the others", does this mean you are adding continue as well?

Kind regards,
Fredrik Widlund

Från: [] för Roberto Ierusalimschy []
Skickat: den 22 juni 2011 19:02
Till: Lua mailing list
Ämne: Re: [ANN] Lua 5.2.0 (beta-rc2) now available

> As I said, I think I read in an old message by Roberto or Luiz (in
> an old of those endless threads about the beauty of continue) that
> Lua team wasn't in principle contrary to the introduction of
> continue as a counterpart of break, but the problem was that it was
> too tricky to get it right with the current (5.1.4) semantics of
> repeat-until because of the possibility of bypassing the scope of a
> local declared after the continue (*IIRC* - please feel free to
> correct me if I'm wrong).

You are :) The problem with repeat-until was only a detail. The main
problem with continue was (and still is) that, for us, it is just one of
many different forms of "domesticated goto" and we did not see why to
include this one without including the others. (We could argue the
same about 'break', BTW.)

-- Roberto