lua-users home
lua-l archive

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


On Fri, Jun 27, 2014 at 9:40 AM, Coroutines <coroutines@gmail.com> wrote:
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


goto and the whole continue "debate" reminds me of the old tree swing cartoon:

http://imgur.com/OKQzxuW

At the end of the day, I'd just be happy with a simply continue!