[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.2.0 (beta-rc2) now available
- From: David Manura <dm.lua@...>
- Date: Wed, 22 Jun 2011 21:33:59 -0400
On Wed, Jun 22, 2011 at 9:46 AM, Gé Weijers <email@example.com> wrote:
> - disallow a definition of a label if that label is already visible in the scope.
When might we ever want to allow two labels of the same name to be
visible from a goto? I don't see a good use case. Here's one
possible case I came up with:
for _,tt in ipairs(t) do
if f(tt) then goto continue end
for _,v in ipairs(tt) do
if g(v) then goto continue end
Personally, I would prefer to differentiate the outer label (e.g.
`::continue2::`) for clarity, and I may need to do that anyway if the
inner loop had to continue the outer loop. (Note: I also
differentiate locals t and tt for similar reasons, but I don't do so
for `_` since I don't care about `_`.)
On the other hand, from the perspective of code generators, if a macro
expands to that inner loop, the macro doesn't need to worry about name
conflicts with surrounding labels (see
<http://en.wikipedia.org/wiki/Hygienic_macro>). However, code
generators can handle that without too much trouble and may need to do
that type of thing anyway for local variables.