[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Globals (more ruminations)
- From: caseyh@...
- Date: Sun, 11 Jul 2010 17:14:09 -0400
Quoting Geoff Leyland <firstname.lastname@example.org>:
On 12/07/2010, at 5:14 AM, Roberto Ierusalimschy wrote:
I still think the main problem is non-intended assignment to globals,
which creates hard-to-find bugs. The simple policy of requiring a global
declaration to assign to globals would force programmers to consider
whether they really want a global variable.
One possible downside of this is that this very simple Lua program:
a = "Hello World"
global a = "Hello World"
(or "local a..."). Does this make Lua harder to learn?
I thought ONLY within a function one would have to use the "global"
prefix and not use the prefix at the top level.