[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Implicit Globals - A compile time solution.
- From: "John Hind" <john.hind@...>
- Date: Thu, 21 Feb 2008 16:35:21 -0000
David Given said:
<<
Give that your original suggestion was that global-by-default causes
pollution of the global namespace if you forget to declare a variable, I'd
suggest that this approach to local-by-default causes pollution of the local
namespace instead --- which I think is exactly the same problem!
>>
Whenever you define a variable you are polluting *some* namespace and it is
good programming practice to make that the most local space possible.
Global-by-default is much worse on this count because it can stomp on stuff
*already compiled* even parts of the *standard libraries*! Remember that
globals are run-time bound while locals are compile-time, so at least the
code you are breaking with locals is in the same file or chunk.