lua-users home
lua-l archive

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


Maybe others had thought of this before, but it just occurred to me this morning. I've never been a fan of local-by-default because the scope was ill-defined. I hadn't thought about the fact that it also arguably makes worse one of the key complaints people have about global-by-default...

On the subject of typos, it is perhaps interesting to note that the various local-by-default proposals provide no more protection than does the current global-by-default behavior. In fact, it arguably provides less since unintended locals are pretty much impossible to detect via analysis or runtime hooks.

So, that issue should probably evolve into the question: Should access to undeclared variables be allowed? Or the similiar: Should there be a standard way to disallow it? The issue that follows from this is that unless one adopts a draconian policy of only allowing a specific white list of values, then there needs to be some way to declare a global variable in addition to declaring a local variable.

(The Lightroom policy is based on bytecode scans for global accesses together with a whitelist.)

Mark