[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Implicit Globals - A compile time solution.
- From: "Greg Falcon" <veloso@...>
- Date: Thu, 21 Feb 2008 14:38:24 -0500
On 2/20/08, John Hind <john.hind@zen.co.uk> 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:
do
if test then
a = 1
else
a = 2
end
print(a)
end
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
well.
Greg F