Re: I'd give my right arm for a continue statement
[
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: Greg Falcon <veloso@...>
- Date: 2011年1月28日 11:00:23 -0500
On Thu, Jan 27, 2011 at 11:42 AM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> do :label:
> ...
> end
>
> Then, a continue could be written like here:
>
> while cond do
> do :process_item:
>
> break :process_item:
>
> end
> end
Interesting. Have you considered using normal string literals to name
blocks, rather than inventing new punctuation for the task? I suspect
it may be more aesthetically pleasing, and it wouldn't break any
existing code, since a string literal can't legally follow 'do' or
'break' in Lua today. (Just throwing the idea out there. It's a
question of taste: just because I think the following fits more nicely
doesn't mean anyone else will. :)
while cond do
do 'process_item'
-- snip
break 'process_item'
end
end
Greg F