Hey, this explains a lot:
> Making all variables global by default was a decision taken in the very early
> days of the design. The rationale is that Lua is designed to be used as
> a configuration language, where end users will hardly ever write their own
> functions. Now imagine the mess of having to write
>
> global fgcolor="red"
> global bgcolor="white"
> global tolerance=0.001
>
> This seems quite verbose and useless, from the point of view of the end user.
> So the decision of having globals by default makes sense to us ;-) and
> we don't feel we need to change it.
(Words by lhf, http://lua-users.org/lists/lua-l/1997-12/msg00009.html )
However, from what I've gleaned on the web, I had the impression that "local
by default" policy was what prevented Python from having proper lexical scoping,
and vice versa - that lexical scoping prevents Lua from implementing "local by default".
Is this true?
Peter