[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 18:22:53 -0700 (PDT)
On Wed, 22 Jun 2011, Roberto Ierusalimschy wrote:
-- example 2
do
::label:: -- 1
goto label
end
::label:: -- 2
So, your second option should also disallow example 2. The first
label is not visible when the second is declared, but the second
label is visible when the first one is declared! (Nevertheless,
this seems a nice compromise between one-per-function and one-per-
block.)
I realize that.
The visibility of labels should probably follow the scope rules you'd find
in languages like Algol 68, with extra restrictions. The rules there make
this a correct program:
BEGIN
PROC foo = (INT i)VOID: (var := i);
INT var := 0;
foo(4);
print((var,newline))
END
The assignment to 'var' inside procedure 'foo' textually precedes the
declaration of 'var', which is legal. I'm not suggesting to do this for
variables in Lua, BTW, or
local print = print
would not be a valid idiom.
Ge'