[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Globals (more ruminations)
- From: David Kastrup <dak@...>
- Date: Mon, 12 Jul 2010 08:06:52 +0200
> Quoting Geoff Leyland <email@example.com>:
>> 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.
Is there a top level?