Re: singleton usage [message #47611 is a reply to message #47610] |
Tue, 21 February 2006 05:58  |
Antonio Santiago
Messages: 201 Registered: February 2004
|
Senior Member |
|
|
vcarlos wrote:
> Hi all,
>
> maybe it is the dumbiest question of all time about singleton, but
> since I am in doubt, is better ask thank keep it :)
>
> When you define a singleton object, everywhere in the program you use
> it you must call something like this: myObject = Obj_New('Singleton'),
> and then myObject will point to the same instance created before. That
> is fine to me, but what I have doubt is about the usage of this feature
> in my program, since everytime I want access that object I will need to
> write the same statement above, or set an attribute in a class to point
> to the singleton instance, right?
>
> What if, instead of doing that, I create an read only system variable
> holding the object that I want use over the program?
>
One of posible implementations of a Singleton in IDL uses a system
variable to hold the object reference. Other solution uses a common block.
> I know I lost some features, but is not it more useful?
>
> Well, that is it. Thanks
>
> (sorry about my english)
>
> Vinicius
>
--
-----------------------------------------------------
Antonio Santiago P�rez
( email: santiago<<at>>grahi.upc.edu )
( www: http://www.grahi.upc.edu/santiago )
( www: http://asantiago.blogsite.org )
-----------------------------------------------------
GRAHI - Grup de Recerca Aplicada en Hidrometeorologia
Universitat Polit�cnica de Catalunya
-----------------------------------------------------
|
|
|