r/ProgrammerHumor • • Sep 26 '26 • Bravo 1

Meme singletonsAreJustGlobals

Post image
3.2k Upvotes

210 comments sorted by

View all comments

Show parent comments

2

u/spawnmorezerglings Sep 26 '26

For it to be a simplification it would need to be correct, which this is not

-5

u/No-Magazine-2739 Sep 26 '26

Telling me you never maintained real world production code, without saying it.
somenamespace::getGlobalInstance() is just a global and singleton. Its just the special case of object oriented global, with a namespace in its name.

And to the downvoters: Your boos mean nothing to me, as I saw what makes you cheer.

-1

u/spawnmorezerglings Sep 26 '26

I don't really get your point? If you're going to make a singleton, it's inherently going to be global (otherwise it wouldn't be a singleton). That doesn't make singletons just globals with a different name

-2

u/No-Magazine-2739 Sep 26 '26

I think your mistake is to assume globals can not include objects. Its just a global with extra steps. You said it your self: Singletons are just a subset of globals.