[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Predefined labels (Inspired by discussion on: Why do we have ipairs?)
- From: Coroutines <coroutines@...>
- Date: Fri, 27 Jun 2014 06:40:36 -0700
On Fri, Jun 27, 2014 at 6:04 AM, djczaski <djczaski@gmail.com> wrote:
> This is a fantastic idea. I really miss continue in Lua and I don't care for
> the messiness of adding the ::continue:: label. If people are against a
> continue keyword the implicit label and 'goto continue' seem like a
> reasonable alternative. Now if this could only get traction with the Lua
> team and become a standard.
Well... as I said in the other thread (and I'm going to repeat myself)
I like how JS uses 'continue' as 'goto'. The syntax would look like:
continue [label];
if some_special_case then
continue
end
if exceptions_a_plenty > 0 then
continue errors_happened
end
-- continue without a label would jump to the end of the parent
block/scope, with a label it would jump to the nearest-scoped label
(shadowing is possible).
Kinda kills to birds with one stone -- kill a keyword, gain continue