[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (beta-rc2) now available
- From: Gé Weijers <ge@...>
- Date: Wed, 22 Jun 2011 06:46:54 -0700
On Wed, 2011-06-22 at 06:57 +0200, Lorenzo Donati wrote:
> I've already argued on the other thread (5.2 beta-rc1) that I'd prefer a
> limit "per-block". There I motivated my preference with an use case for
> error management.
>
I agree. There are two possible restrictions that would work:
- your suggestion: allow one definition of a label per block. Algol
scope rules apply within a function:
::label::
do
goto label -- should jump FORWARD
::label::
end
- disallow a definition of a label if that label is already visible in
the scope. The above example would be illegal, but the next one would be
ok:
for i in something() do
...
goto continue
...
::continue:: This is a little tricky in a one-pass compiler:
end
for i in something() do
...
goto continue
...
::continue::
end
Advantage: you can decide on the fly whether a jump is forward or
backward, and you disallow one label hiding another. This is a little
more restrictive, but your 'continue' example works.
Gé