lua-users home
lua-l archive

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

On Tue, Feb 26, 2008 at 5:23 PM, Alex Davies <> wrote:
> From: "Alexander Gladysh"
> > Continue contradicts with my understanding of single exit point idiom.
>  I don't think single exit point theorem has any place in a language that has
>  both a "return" statement and allows multiple returns. At least not to be
>  followed religiously, or it'd lead to some terribly inefficient code.

Of course! I myself write a function in a month which does not follow
this rule. :)

It is just a programming habit which I like follow, and which makes
code cleaner for *my* eyes.

>  Remembering that no programmer will be forced to use continue, I don't
>  really see any negatives. Besides of course that it'll be hard to remove
>  from the language at a later date, should it prove incompatible with some
>  new syntax ;) (eg, the repeat until scope rule). Although it's rarely
>  needed, the few times where is it currently require a complete code
>  restructure, and possibly temporary state variables that would otherwise
>  uneeded. Plus most people take it for granted that the language will support
>  it. My vote goes for keep repeat untils, keep the repeat until scope, but
>  throw an error if your continue jumps in to access of locals declared
>  beneath it.

I agree.

Though, adding a continue would bring discussions about adding
continue N and break N (for exiting/continuing Nth nested loop above)
-- features for which I vigorously against. :)