[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 02:49:40 -0700
On Fri, Jun 27, 2014 at 2:41 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2014-06-27 11:27 GMT+02:00 Paige DePol <lual@serfnet.org>:
>> On Jun 27, 2014, at 4:15 AM, Sean Conner <sean@conman.org> wrote:
>>
>>> If you are serious about this, you can remove "while", "repeat", "until",
>>> "else", "break" and "for" and replace them all with just "if" and "goto".
>>
>> Indeed you *could*, however, I can't imagine why anyone would *want*
>> to do such a thing.
>>
>> In my view the whole point about adding extra loop controls (ie: continue)
>> is to make the code look cleaner and to reduce possible errors... which
>> is why I added both the `continue` keyword and the shortcut if style
>> statement to my Lua variant.
>
> Please, I was not arguing in favour of doing everything in terms of
> "if" and "goto". I was
>
> - pointing out that "break" is merely a short spelling of "goto break",
>
> - and that it would be possible use the same mechanism to add the
> constructions "continue", "resume" and "restart" to loops, although
> spelling them "goto continue", "goto resume" and "goto restart",
>
> - and begging for help in doing so from people that understand the
> logic of lparser.c.
>
I like the python-style 'else' on a for loop if no iterations occurred :D