[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: State machines and goto (Was: Next Version of Lua?)
- From: "John Hind" <john.hind@...>
- Date: Thu, 11 Jun 2009 13:01:33 +0100
Not sure if any existing language does this, but it strikes me that
composite loop structures would be a more elegant way of implementing this
kind of thing:
local done = false
for a in foo until done do
for b in bar until done do
if something then done = true end
end
end
labelled jumps are ugly and error-prone, particularly if they are limited by
non-obvious restrictions.
> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br [mailto:lua-
> bounces@bazar2.conectiva.com.br] On Behalf Of Alen Ladavac
> Sent: 11 June 2009 11:50
> To: Robert Raschke
> Cc: Lua list
> Subject: Re: State machines and goto (Was: Next Version of Lua?)
> If there is a forward goto (or named loop break) available in the
> language, and look like this:
>
> local exita = false;
> for a in foo do
> for b in a.bar do
> if something then
> exita = true;
> break;
> end
> end
> if exita then
> break;
> end
> end
> breakbothloops:;
>
> JM2C,
> Alen