lua-users home
lua-l archive

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


On Mar 1, 2012, at 6:02 AM, Tony Finch wrote:

> Mark Hamburg <mark@grubmah.com> wrote:
>> 
>> What if the lightweight syntax didn't support functions with upvalues?
>> One could still reference globals, but a reference to a lexically bound
>> but non-local variable would be an error in a lambda expression,
>> whatever the syntax.
> 
> Note: in 5.2 _ENV is an upvalue; forbidding upvalues also forbids globals.

_ENV is a magic upvalue. Magic rules might apply. Or simply that these horrendously restricted lambdas would exist at and be created at the chunk scope but the compiler would check to make sure that shifting their scope in that way didn't convert upvalue references to global references.

Mark