[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: I'd give my right arm for a continue statement
- From: David Kastrup <dak@...>
- Date: Sun, 23 Jan 2011 19:48:24 +0100
Mark Hamburg <mark@grubmah.com> writes:
> Three seemingly simple answers to the repeat/until v continue problem
> (in order of decreasing harshness but more complex definitions):
>
> * Disallow continue in repeat/until loops
> * Disallow continue in repeat/until loops where the loop condition
> references a variable declared inside the loop
> * Disallow continue if it makes the loop condition reference variables
> that might not have been declared
There is also another simple solution:
* don't treat continue as part of repeat/until loops
That is, it would continue an outer loop, if any. More so than
restart-at-top, the result would tend to be unexpected.
In C, sometimes some constructs can be made nicer by making use of the
fact that inside a switch statement, "break" is local to the switch
statement, while "continue" refers to an enclosing loop.
The resulting semantics are useful, but clever.
Lua does not tend to favor cleverness.
> I would say I don't really care about this issue all that much, but I
> do use the break as continue trick a bit more often than feels
> legitimate for someone who doesn't care.
Yup. Too clever.
--
David Kastrup
- References:
- I'd give my right arm for a continue statement, Steve Litt
- Re: I'd give my right arm for a continue statement, steve donovan
- Re: I'd give my right arm for a continue statement, HyperHacker
- Re: I'd give my right arm for a continue statement, Michal Kottman
- Re: I'd give my right arm for a continue statement, steve donovan
- Re: I'd give my right arm for a continue statement, Axel Kittenberger
- Re: I'd give my right arm for a continue statement, David Kastrup
- Re: I'd give my right arm for a continue statement, GrayFace
- Re: I'd give my right arm for a continue statement, T T
- Re: I'd give my right arm for a continue statement, David Kastrup
- Re: I'd give my right arm for a continue statement, Mark Hamburg