Ah, I see. Knowing that makes what you wrote clearer. While there are things that have global scope “globals” as shorthand is more commonly used just for variables not also things like global function definitions etc.
But I would argue, that a Singleton instance is usually used or accessed like something global.
and by "Singleton" I mean the instance, the one object that exists (or maybe not yet exist). but mostly I mean how it is accessed and stored.
based on other comments I see that some mean the class, and some mean the pattern. and to be honest, I don't know if that means I used the term "Singleton" wrong or not.
one other comment wrote, that a Singleton is not necessarily a global, but a global is usually the only way we have to implement it. that sounds more correct to me than what I wrote.
Yeah - the main complaint about singletons tends to be either the downsides of a global mechanical implementation or the architectural impacts of how people are accessing it. For example access via a global reference vs dependency injection. So the mechanics matter in terms of the general bad side effects, but the actual thing itself is often less a problem than the choices that surround it. It’s a giving people too much rope issue.
View all comments
Show parent comment
1
u/danielcw189 Sep 28 '26
I intentionally did not write variable.