On Wednesday, July 30, 2003, at 01:56 PM, Joseph J. Strout wrote:
Given that modules are not objects but are still logical holders of
global
methods and properties, is it technically possible to add
constructor/destructor functionality to initialize properties?
Sure, it's possible. But why? Wouldn't it make more sense to use a
class for this sort of thing?
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.
I have a lot of modules with an Init method, which I have to be sure
to call at the beginning of my app. I can certainly see the value in
having that method called automatically by the compiler at app
startup. (And perhaps another one called when the app is exiting,
too.)
I also commonly use modules that must be initialized from the App.Open
event. Module constructors and destructors would definitely come in
handy.
I signed on to:
http://support.realsoftware.com/feedback/
viewreport.php?reportid=oegkdhjs
Bob
---
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/>
.
|