in reply to Re^2: Common subs and Global Variables
in thread Common subs and Global Variables

The biggest issue is "action at a distance". That is, it is much harder to ensure correct management of global variables because the code that may affect them may be scattered through the code base. That makes it hard to think about how the various places that may alter or use a global variable interact.

For trivial code it doesn't matter at all. But the use of global variables don't scale well as code size increases.

A significant exception to the "don't use globals" guideline is using global constants. Because they are constant there is no issue with figuring out how their value may change (it doesn't - they are constants!). Using global constants to manage things like scaling coefficients or other magic values is vastly better than using manifest constants.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond