lua-users home
lua-l archive

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


* Edgar Toernig:

> Roberto Ierusalimschy wrote:
>>
>> - Any use (access and assignment) of "a" in the scope of a "global a"
>> declaration is translated to "_ENV.a".
>> 
>> - Any access to a free "a" (that is, outside any declaration for "a")
>> is translated to "_ENV.a".
>> 
>> - Any assignment to a free "a" that is outside the scope of any
>> other global declaration is translated to "_ENV.a".
>> 
>> - An assignment to a free "a" that is inside the scope of another global
>> declaration is an error ("attempt to assign to undeclared variable
>> 'a'").
>
> Rather bizarre ...

Not really, the final rule is just there to ensure backwards
compatible.  It would be simpler to enable the error by default, but
that means that lots of code would have to be changed.