lua-users home
lua-l archive

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


On Jul 16, 2010, at 5:19 AM, Roberto Ierusalimschy wrote:

>> I'm trying to think when I would use this.  Under my normal coding
>> style, I have no real problem with unintentional global sets
>> associated with SETGLOBAL opcodes because I ban SETGLOBAL (plus other
>> things) in my lint checks.  Perhaps the only small improvement to this
>> would be some standardized way (e.g. pragma or comment) to assert in
>> source code that "SETGLOBAL opcodes are banned" so that the Lua
>> compiler can bark on it without the complication of running an
>> external tool (which newbie users wouldn't do).
> 
> Exactly. (Moreover, 5.2 will not have SETGLOBAL opcodes anymore ;)

Though not having SETGLOBAL opcodes makes it harder to check the code...

For what it's worth, inadvertent global creation has not been a significant problem in Lightroom. Our global check is much more about trying to access functions that don't exist because the name was spelled wrong. So, our tool checks all uses of GETGLOBAL as well against a white list.

Mark