[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why are people so afraid of globals?
- From: Vaughan McAlley <vaughan@...>
- Date: Fri, 9 Jul 2010 10:58:43 +1000
On 9 July 2010 10:03, Vadim Peretokin <vperetokin@gmail.com> wrote:
> I'm not sure why. In my case, they're great for newbie scripters (who just
> want to use the language to accomplish some simple goal with help of
> scripting) - their variables work across a variety of inputs/outputs they
> can interact with since they're global to the state.
>
Personally I liked being able to use globals before I learned how
lexical scoping worked. They are definitely easier to use for
beginners, which I think is part of why Lua is easy to learn. I would
advise beginners to give their variables unique names of course.
Though if I "pollute the namespace" with a global called "a" or
"count", it’s only 50% my fault :-)
Vaughan