comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » What about real polymorphism ??
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: What about real polymorphism ?? [message #42021 is a reply to message #41991] Tue, 14 December 2004 09:06 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Tue, 14 Dec 2004 02:29:57 -0600, Michael Wallace wrote:

>> A singleton is very possible with IDL:
>> Just use a global variable (also as your access point) and
>> check its existance in the constructor.
>
> You know you drive all of us OO guys crazy with comments like "just use
> a global variable"?
>
> There is a big difference between a global variable and a singleton.
> You're only thinking of the access point, not the rest of the pattern.
> I'd be VERY surprised if it's possible to implement a true singleton
> pattern in IDL. I'd love to be proved wrong, but I don't think it's
> possible with IDL's so-called "objects."
>
> Mike

Good Wiki article with description and plusses and minuses on
singletons: http://c2.com/cgi/wiki?SingletonPattern

My favorite quote:

Singleton is a social disease. Because Singleton is so easy to
understand, it is the single pattern that almost anybody who merely
thumbed through GoF at the bookstore can remember and explain. That
leads to unwarranted exuberance for the pattern among those who can
least afford such exuberence.

You *can* implement a singleton in IDL (yes, using a common block or
system variable). Try a search:

http://groups.google.com/groups?as_q=singleton&as_ugroup =*idl-pvwave*

The chief drawback is, since there are no class methods in IDL, either
you can't override or extend the code which enforces "only one
instance" (without modifying it directly), or you have to use a
regular method as if it were a class method, discarding a "dummy"
instance. A bit ugly, but it gets the job done. Note that IDL>6
won't let you delete the self variable in Init, so my old Singleton
class would need changing. I prefer the singleton generator function
technique.

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: building loops at the command line
Next Topic: Reg VarRoi

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Tue Oct 14 03:27:45 PDT 2025

Total time taken to generate the page: 4.16224 seconds