lua-users home
lua-l archive

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


On 23/06/2011 11:24, Fredrik Widlund wrote:
You say "we did not see why to include this one without including the others", does
this mean you are adding continue as well?

No, this means that goto was a flexible way to include the others, ie. it embraces break, continue and any creative usage you can think of.

Java has no goto, but it has labeled break/continue [1], which is a "polite" (disciplined?) way of doing gotos. I code in Java for living for quite some time now, but I rarely used (and saw) this feature. But I did, occasionally.

These can be also useful for finite state machines, particularly when we don't have switch, although lot of people shown that coroutines can be useful in this field.

The fact that Lua introduces goto doesn't mean (I hope) that we will see 8bit-Basic-like code in Lua (so called spaghetti code), just that we will have an additional tool in the tool box, that we can use when the need arises (ie. sparingly!).

Just recently, I found back an old Lua code where I was complaining in a comment of the lack of continue, so, yes, I find this addition useful. :-)

[1] http://stackoverflow.com/questions/46496/should-i-avoid-using-java-label-statements

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --