lua-users home
lua-l archive

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


On 15/04/2013 21:42, Steve Litt wrote:
Globals suck. At least, globals intended to be or contain data. An
abdication of encapsulation.

It depends...
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...

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --