lua-users home
lua-l archive

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

On 11/10/2011 07:13 PM, Luiz Henrique de Figueiredo wrote:
Would it be possible for the compiler to ensure that _ENV is always the first upvalue?

Possible, yes, but it would bloat *all* functions and many functions do
not use globals at all.

How about ensure that if _ENV is present then it is the first upvalue? So you check for it without a loop. The first upvalue is either _ENV, some other variable, or nil; only the first case references globals. Furthermore, don't strip the _ENV name and it will still be found even when other variable names are removed.

- tom