[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: global keyword instead of local
- From: "Russell Y. Webb" <rw20@...>
- Date: Sat, 26 Aug 2000 13:15:08 -0700
I modified Lua to require global and local declarations once. This was back
when lex was still used for parser generation so the code I wrote is useless
now. Removing the requirement of the local keyword was my next goal.
Such a default to local system is much more controlled and less error prone
(I think), but is a major change to the language.
It turns out that you can redefine the setglobal tag to prevent global
creation save through some global("name", value) function call. This does
most of what I wanted so I stopped worrying about changing the language. Of
course you still have to use the local keyword, but that's a fairly minor
> From: "Martin Dvorak" <email@example.com>
> Reply-To: firstname.lastname@example.org
> Date: Sat, 26 Aug 2000 21:56:48 +0200
> To: Multiple recipients of list <email@example.com>
> Subject: global keyword instead of local
> Hi all,
> 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.
> Thanks for help,