[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: One more item to the collection of Lua hate-speech
- From: Geoff Leyland <geoff_leyland@...>
- Date: Fri, 2 Jul 2010 10:20:11 +1200
On 2/07/2010, at 9:58 AM, HyperHacker wrote:
> On Thu, Jul 1, 2010 at 15:18, liam mail <liam.list@googlemail.com> wrote:
>> If I were to be totally honest the thing which I dislike most about Lua is
>> the keyword 'local'...
> 
> I agree, defaulting to global scope is one thing that always irks me
> in Lua...
> 
> I'm sure it has some advantages, but they're escaping me at the moment.
Local by default used to confuse me no end in Python.  If Lua used it then:
do
  a = 1
  do
    a = 2  -- is this a new local or the same as the one above?  How do I tell Lua whether I want it to be the same or different?
  end
  print(a) -- does this print 1 or 2?
end
I much prefer global by default - it seems do be defined better.
Cheers,
Geoff