3 ms·
The problem with "when all you need is a function don't use an object" is that's it's a recursive definition. There are people who think they need a singleton
by slver 6y ago
The problem with "when all you need is a function don't use an object" is that's it's a recursive definition.
There are people who think they need a singleton all the time, imagine where similar definition would have brought them.
How a function is defined varies from language to language, but if we're talking about a globally accessible named function, this is in effect a singleton.
It means you can't configure this function (through construction parameters), or replace it, or mock it, etc. it's in effect a "singleton function".
BTW, abstraction != inheritance.