lua-users home
lua-l archive

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


> In Lua 5.2, we can *always* write _ENV.x instead of x, with exactly the
> same meaning (and creating the same opcodes). So, the compiler could
> impose some restrictions on the use of 'x' by itself in some scenarios;
> the user can always write _ENV.x if needed.

Combine this with an import ... from table statement that creates
locals and I think that you have a killer :-). You get a convenient,
faster access to the globals you need.

import math, table from _ENV as m, tbl

you make the as clause optional, and default on _ENV if the from
clause is omitted.

Assigning to a  naked, undeclared variable would create a local in the
current lexical scope (assuming an identically named upvalue doesn't
exist, of course). You could keep the local statement for declarations
without assignment, and to override upvalues.

-- Pierre-Yves

-- 
-- Pierre-Yves