lua-users home
lua-l archive

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

Eric Tetz wrote:
> --- "Russell Y. Webb" <> wrote:
> > Great that this is being addressed.
> I highly doubt this discussion is going to affect a change in Lua, as much as we would like to see
> that happen. As you already know, this issue has come up time and time again over the years,
> always sparking a long running discussion before finally trickling off.  You'll notice there has
> been no 'official' response to the current discussion.
> I think the whole topic was pretty much laid to rest four years ago:
> "...the decision of having globals by default makes sense to us ;-) and we don't feel we need to
> change it."
>   - Luiz Henrique de Figueiredo, Dec 11 1997
> Here's other mentions of it in the archives...


Hi Eric,

Pretty impressive your research in the list archives,
but your message gives the impression that everybody but the Lua authors
prefers the
local-by-default approach.
So, I decide to give my opinion! :-)

I have been using Lua since 1993 in many different kinds of projects,
and I can say that I do prefer the global-by-default approach.
I use interactive command console interfaces a lot:
for debugging, for management tools, for "script prototyping"
(to figure out which script I need).
For interactive consoles, I think the global-by-default approach is

For sure that I can waste some time when I misspell some variable name,
but the solution provided by tag methods (plus a "global" function) to
this kind of mistake fits all my needs.
And all practical complaints against global-by-default that I have heard
other Lua programmers could be solved with the same mechanism.
I guess (and hope) the Lua authors are just thinking about making this
more automatic.

Visual Basic (another quite popular language among "non-expert"
has a very similar set of scope rules and a protection mechanism
with the same result that we can reach with the tag method solution.
I taught Visual Basic some time ago and I have never seen any student
with difficulty to understand or to use the global-by-default approach.

For large projects, I use almost the same solution that Roberto
in his LTN. But, in general, I have to adapt it for the particular
of each project. I like this kind of flexibility.
(BTW, when I don't want flexibility, I use C or C++).

I can agree that it might exist a better set of scope rules, but all
that I have seen in this list along all these years are at least strange
for me...

Well, I just want to say that there is not a consensus about scope rules
among Lua programmers...

Best wishes,