I would love to avoid using statements that could easily produce bugs and that require scripts and modules that consist of many long lines of code. But one needs to write "programs" that do what the business processes requires. If a business process is complex, one cannot "translate" that in a small set of short scripts.
In my case, I've considered (and tried) other ways (like arguments and classes) to avoid using globals. But these other ways forced me into very long and complex lines of code that quickly result in an almost unreadable "program". Some statements on the internet, stating "globals are OK if used correctly", combined what the fact that "globals" in theory provide the functionality that I need without to much "overloading" statements with lots of names of variables and arguments, made me look into globals again.
To avoid accidentally mixing using global variables with local variables, I make sure that all names of global variables begin with the same letters (Glbl....). That makes it easy to spot them in a script. And it reminds that the "global" statement are to be added where required.
B.t.w.: Of course I beleave you that certain constructions are better not used. But in these cases, I would like to be pointed to an alternative solution to my problem ("how can I get the required result without using the not-recommended way"), preferably with examples, rather than "don't do this", like many other forums do.
In my case, I've considered (and tried) other ways (like arguments and classes) to avoid using globals. But these other ways forced me into very long and complex lines of code that quickly result in an almost unreadable "program". Some statements on the internet, stating "globals are OK if used correctly", combined what the fact that "globals" in theory provide the functionality that I need without to much "overloading" statements with lots of names of variables and arguments, made me look into globals again.
To avoid accidentally mixing using global variables with local variables, I make sure that all names of global variables begin with the same letters (Glbl....). That makes it easy to spot them in a script. And it reminds that the "global" statement are to be added where required.
B.t.w.: Of course I beleave you that certain constructions are better not used. But in these cases, I would like to be pointed to an alternative solution to my problem ("how can I get the required result without using the not-recommended way"), preferably with examples, rather than "don't do this", like many other forums do.