lua-users home
lua-l archive

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


On Sun, Jul 11, 2010 at 15:14, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> One possible downside of this is that this very simple Lua program:
>>
>> a = "Hello World"
>> print(a)
>>
>> becomes:
>>
>> global a = "Hello World"
>> print(a)
>
> There should be some toggle to control this. A simple one is the
> "global" declaration itself. When a chunk uses a global declaration
> it switches on the control.
>
> (You may start you chunk with "global NO, THANKS" ;)
>
> -- Roberto
>

I think rules like "only if you used the keyword before" or "only
within a function" are going to make things more confusing than always
requiring scope to be declared.

-- 
Sent from my toaster.