lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 2/20/08, John Hind <> wrote:
> Yea, mailing list is a lousy way to have a long term discussion like this!
>  Maybe we could have an "architectural discussion" area of the wiki?
>  I keep coming across the "global by default is bad, local by default is
>  worse" statement, but I've never seen a convincing justification for it.
>  There's lots of code examples that people claim "don't do what you'd
>  expect", but mostly they do exactly what I'd expect!

One case I haven't seen yet mentioned in this thread is the following:

  if test then
    a = 1
    a = 2

which under your proposal would print nil!

It's certainly a matter of opinion, but my opinion is that is quite
bad, and very hard to justify to novice coders.

As has also been mentioned, a=a+1 meaning "create a new local set to 1
more than the global variable's value" would be quite disorienting as

Greg F