lua-users home
lua-l archive

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

Because I'm new to Lua I'm going through some cool Lua projects (lqt,
nanoki,...) in order to see how the language is used in real world

Even if you just look at the source from a distance, not necessarily
trying to understand what the code actualy does, you notice the
excessive use of the "local" keyword.

- Setting the default scope to "global" why is that really usefull? I
think most of the time, you try to avoid global state. Why not the
default scope to "global"? Wouldn't that reduce a lot of typing?

- What if the developer forgets a "local"? The program runs anyway,
but there is a chance that there is some unwanted behavior that is
hard to trace.

I think I miss something here. Could somebody explain me the reason
behind the design decision?

thanks a lot