Just initialize whatever you want to share in the main function and pass it in to where it's needed?
I'm sorry if I sound dismissive, it just really doesn't sound like a good idea.
Words like implicit dependency, side effect, singleton, and not thread safe come to mind.
Why touch something that wasn't passed into your function?
That's not the same thing.
It's definitely not the same, I agree.
Can you give an example of when you'd want to use one?
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.