lua-users home
lua-l archive

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

This does mean that a script needs to be compiled in an environment so that
we know what the pre-existing globals are. Or one has to be more restrictive
and say that global lookups have to happen at the top-level. That may be
more efficient for code, but makes one-off code harder to write.

On the other hand, if scripts were compiled in environments, then setfenv
might be able to go away which would potentially open up other optimization
opportunities since right now you the compiler can't try to lift function
definitions up to points where they would be instantiated less often since
it can't tell whether the environment will be changed. (I guess it could do
so for functions with no global references.)


on 10/25/04 10:28 AM, Asko Kauppi at wrote:

> How could I miss that?  Sure, it would be a perfect solution,
> simplifying the way I (and others) now do various safety nets to find
> typos.  And, the parser could do the check at parse time, not runtime
> (there's a vital difference there, since not all execution paths can
> always be tested against).  My vote for this!
> -ak
> 25.10.2004 kello 19:49, Mark Hamburg kirjoitti:
>>   Perhaps "new" globals should only be allowed at the top level of a
>> chunk.