lua-users home
lua-l archive

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


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