On 07/08/14 14:06, Roberto Ierusalimschy wrote:
1) Local by default is a mess.
Incredibly, even if you don't have globals!
The shortest explanation I've found is the following example:
x=1
function f()
x=2 --which x is this?
end
b()
print (x)
With local by default, there are two possibles interpretation for the
inner x variable. If it means a new x, how can you actually change the
outer x? If it means the outer x, then it is not actually a local. If
you have such a "local" in you function, and someone uses a equally
named variable in an enclosing scope they will collide.