While not ideal, I've been experimenting with an approach. I create one
module into which I put all of my singletons. In that one module I
create one property and method. Say I want a singleton "Thing". I create
a class CThing, then I create a property in my Singleton module called
mThing and a Thing method. The Thing method looks something like:
function Thing() as CThing
if not mThing then mThing = new CThing
return mThing
end function
Then, in my code, I can do stuff like:
Thing.SomeMethod
And the right thing happens.
Joseph J. Strout wrote:
Because a class is useless by itself; you have to have an object.
Sometimes a Singleton object is the right approach, but often not -- and
even when it is, in RB, you would need a module to manage your singleton
instance. That's a nuisance.
---
A searchable archive of this list is available at:
<http://support.realsoftware.com/listarchives/search.php>
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
.
|