lua-users home
lua-l archive

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


On Wednesday, November 21, 2012 06:31:16 AM David Favro wrote:
> That's true and can be a bug waiting to happen, but that's really
> unrelated, it's a consequence of scoping/shadowing of names in general:
> you could make the same argument about any access to a global name from
> within an inner scope; the "globality" is broken when a local with the
> same name is declared in a containing block (or earlier in the same
> block), which is even more likely to cause a bug.  In general, the
> referent of any reference to a name is likely to change any time that a
> new entity is declared with the same name.  We mitigate this risk by using
> the 'local' keyword, but even then we can still break the code with a new
> 'local' declaration of the same name between the existing declaration and
> a later reference.

The problem that relocal solves, then, has not gone away but is merely moved 
to another place. I guess you could call this "messy wallpaper programming".

I'm not sure there is a solution. If we could always make a word mean exactly 
what we intend it to mean there would be no need for lawyers.

-- 
tom <telliamed@whoopdedo.org>