[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: globals (_locals)
- From: "Nick Trout" <nick@...>
- Date: Thu, 7 Jun 2001 12:51:11 +0100
This sounds like a great solution. - No flags, no switches, no pragmas.
Good. Probably better than Python as you dont get misnamed locals.
If you have no globals to reference would you do:
function f() -- OK
global -- turns on dmode (only inside f)
c = 1 -- ERROR; c is undeclared
end
This would be a redundant question if you inherited the dmode.
N
From: Roberto Ierusalimschy
>> the following could work:
a = 3; -- OK, default is declaration mode (dmode) off
function f() -- OK
global b -- turns on dmode (only inside f)
b = 1
c = 1 -- ERROR; c is undeclared
end
x = 4; -- OK; out of scope of "global b", so back to dmode off
On the other hand, if the chunk starts with "global", then everything
in it will inherit the dmode on.
-- Roberto