[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: In praise of globals
- From: Philippe Lhoste <PhiLho@...>
- Date: Wed, 17 Apr 2013 12:59:27 +0200
On 15/04/2013 21:42, Steve Litt wrote:
Globals suck. At least, globals intended to be or contain data. An
abdication of encapsulation.
Constants contain data, and might need to be global.
So, let's make it: globals intended to contain mutable data...
And an application state need some globals, like a reference to the display frame if
that's a GUI, the saved state of the document if it is mono-document, etc.
And, well, I have several simple scripts where everything is global, because they are...
simple (and short lived).
There is no simple, hard and fast rule.
It reminds me of the discussions about the "evil" goto...
-- (near) Paris -- France
-- -- -- -- -- -- -- -- -- -- -- -- -- --