Global variables inside modules
I shortly discuss few ideas that arise when you have modules and global variables in a programming language.
We start with an early BASIC-language, except that it provides procedures and modules.
Modules make it possible to share code between projects without copying it along, but they add implicit global state you cannot reuse or control.
One way to resolve this is that you could disallow global variables inside modules. This would mean that people have to explicitly pass all parameters into the programs. This kind of choices have been made in popular programming languages.
An another way to resolve this is to re-introduce global variables in a dynamic scope. You can statically analyse the state changes as co-effects.
I like the later choice because it acknowledges that the global variables inside modules are useful.