Why people dislike global variables so much while I find them so convenient?

forkit forkit at gmail.com
Tue Jan 25 10:54:59 UTC 2022

On Tuesday, 25 January 2022 at 09:53:25 UTC, rempas wrote:
> So can someone make examples about how global variables can 
> mess me up. I know that probably everyone here has more 
> personal experience than me so I really want to learn why 
> global variables are considered so harmful.

If a computational path requires the use of a global variable, 
then use it.

What will mess you up, is not the global variable, but whether 
you know - for certain - the computational path(s) that use that 
global, and what effect those paths may have on that global.

It's pretty straight forward ;-)

More information about the Digitalmars-d mailing list