We sometimes need singletons in our programming. A singleton is a single static global instance of some object, where that instance is the only possible instance of its class.
A top-level val
property is close to a singleton, in that it is a static global
instance of some object. However, other code could create an instance of the class
via the class' constructor. So, here, QUASI_SINGLETON
is not truly a singleton.
You can learn more about this in:
Tags: