3 ms·
Singleton is orthogonal to namespaces. One is about data creation and the other about naming stuff. If I want to create new pieces of data, I have to make an a
by hajile 4y ago
Singleton is orthogonal to namespaces. One is about data creation and the other about naming stuff.
If I want to create new pieces of data, I have to make an allocation with a constructor. Reusing methods provided by modules is effectively the same as classes (the two being mathematically equivalent, but closures not having all the footguns).
This is true no matter if your code is OOP, imperative, or functional.