lua-users home
lua-l archive

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


> While I really like mandatory global keyword, I'd also want
> 
> arbitraryName = "Hello World"
> 
> to work for some chunks with custom environments (i.e. config files).
> 
> It is not good to force config file authors to write
> 
> global NO, THANKS
> 
> at the start of file.

The default is no declaration. Only coders concerned about their use
of globals (e.g., people writing modules or large programs, or people
complaining about global-by-default ;) would add such thing.


> Perhaps it should be an argument to the load*() function?

Global declaration would be a purely syntactical thing. It does not
improve "security" in any way; one can always write "_ENV.x" to
access any global. It would only control the availability of a syntax
sugar. So, I think it is the one writing the chunk that has a say about
whether she wants or not the sugar, not the one using the chunk.

-- Roberto