lua-users home
lua-l archive

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

--- "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...

" basic problem is that default global access easily turns typo-bugs into really difficult
ones (that can be extremely execution order dependant).  Creating and accessing globals
inadvertantly also makes writing a long up-time, multi-user, scriptable program almost
  - Russ Webb, Dec 10 1997
"Except for the requirement for a "local" keyword, Lua look like an ideal language for me."
  - Fred Bertsch, Dec 11 1997
"Lua is great on almost every point, except the scoping rules.  Is there any who likes these
scoping rules?"
  - Freek Brysse, Jun 4 1999

"How hard would it be to modify Lua source code to add "global" keyword for explicit declaration
of global variables and make all variables local by default?  Current implementation of Lua uses
opposite approach, but that approach is problematic for us because our scripters are not
programmers and it seems there is no force which makes them remember that they always have to
declare their variables as local."
  - Martin Dvorak, Aug 26 2000

"This is one thing I never understood. Why is it implemented that way - in all other programming
languages (that I know) variables in subroutines/functions are automatically local. Is there a
reason, why it is implemented the other way round?
  - Martin Doering, Aug 28 2000

"I think this is probably the biggest language design issue with Lua.  I have puzzled over bugs
resulting from this even though I knew about it, and I think it's simply error prone.  Otherwise,
I think the Lua language design is great."
  - Tom, Sep 13 2000

"I agree strongly with this, and I too feel it's Lua's biggest problem."
  - Reuben Thomas, Sep 13 2000

"I'm agreed that undeclared variables defaulting to global is *bad*."
  - Nick Trout, Sep 15 2000

"It's starting to become apparent to me that life would be easier if new variables were local by
default, instead of global."
  - J. Perkins, May 22 2001

Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!