Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Saying "Global variables are bad!", is like saying "Drugs are bad!". Used wrongly they can be harmful. Used correctly they are a powerful good. And remember, entries in the symbol table are just global variables. So, if you substitute a 'singleton' instance, for a global variable, you are just substituting (at least) one global variable for another. And making your code far more complicated to boot. If you need global access to something, use a global variable. It's cleaner, clearer and safer. Like 'democracies' in which only one party is allowed, classes in which only one instance is allowed, are just a sham, putting a politically acceptable face on the truth. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In reply to Re: Are global variables "bad"?
by BrowserUk
|
|