lua-users home
lua-l archive

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

On Mon, Jul 15, 2019 at 2:50 PM nobody <> wrote:

> Is any global variable (including one that's `nil`) acceptable?

Yes, but see below.

> If you use the same mechanism, that means that `with` again allows arbitrary undefined variables, so it doesn't really improve the situation much w.r.t. accidental globals.

The outermost with-declaration can mention any name. After that, any name, in an inner with-declaration or otherwise, must either be one in the innermost with-declaration or be defined locally in the innermost with-scope. So your room for accidental globals is very, very small.

> In the simplest non-magic case, all you say is   _ENV = module( ... )

See, you think this is not magic :)