📝Dynamic scoping is a better model for global variables

Seibel2005, §6. Variables

Dynamic scoping for global variables allows for better dependency injection and testability. You can override the variable’s value for one function call without affecting the rest of the program.

They can parameterize the behavior of a module in a disciplined way; they are “tamed” global variables that support concurrency and re-entrance. —https://wiki.c2.com/?SpecialVariable

See also


Want to receive my 🖋 posts as I publish them?