[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: globals (_locals)
- From: Jean-Claude Wippler <jcw@...>
- Date: Sat, 2 Jun 2001 10:03:04 -0700
>> More concretely, any variable that
>> occurs anywhere on the left hand side of
>> ":=" anywhere in a function would be declared
>> local to the function (not just local to the block).
>Oh no! :-(
>Please keep Lua as simple at it is. This is complicated stuff.
It's far worse than that. The problem is identifier scope, not
assignment. To make "a := b" affect other lines where "a = b" is used is
an extremely confusing way of overloading assignment.
Hmm... how about one of the following alternatives:
- all local identifiers must start with an underscore ("_")
- all global identifiers must start with an upper-case letter
The first would require going through all existing code, looking for the
"local" reserved word and altering names (it seems like that could be
The second would break every Lua script currently in existence, because
all Lua library functions would have to be renamed.
I repeat that I do not consider the current scoping an issue. The
"globals.lua" and "undefined.lua" scripts provide ample security IMO.
But if it had to change, I'd vote for "_localname", and eventually
dropping the "local" reserved word.