iTools ambiguity [message #64693] |
Tue, 13 January 2009 21:48  |
Robbie
Messages: 165 Registered: February 2006
|
Senior Member |
|
|
The documentation for IDLitDataContainer says that its superclasses
are IDLitContainer and IDLitData however I attempt the following
obj = obj_new('IDLitDataContainer')
obj -> IDLitContainer::Add, obj_new('IDLitComponent')
and I get an error. Instead I must do
obj -> _IDLitContainer::Add, obj_new('IDLitComponent')
Evidently the IDLitContainer behaviour has been implemented using
_IDLitContainer (an abstract class).
This is a somewhat loaded question, but which superclass is correct?
Is it _IDLitContainer or is it IDLitContainer?
|
|
|
Re: iTools ambiguity [message #64739 is a reply to message #64693] |
Thu, 15 January 2009 07:52  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On Jan 14, 9:28 pm, Robbie <ret...@iinet.net.au> wrote:
> I find that IDL lets me do many things which are just plain confusing,
> insane and weird.
> I'd be lost if it weren't for IDLdoc to guide me through my own code.
Thanks!
Yes, I ended up running IDLdoc on the iTools directory of the IDL
library to try to figure out what was going on.
By the way, a new version (IDLdoc 3.2) will be coming out soon. Make
sure you are on the mailing list if you want to participate in the
beta and be notified of the release:
http://lists.idldev.com/listinfo.cgi/idldoc-idldev.com
New features for this release will include:
* ability to generate printed documentation i.e. LaTeX to PDF
* generate documentation for DLMs
And of course, some bug fixes.
Mike
--
www.michaelgalloy.com
Tech-X Corporation
Associate Research Scientist
|
|
|
|
Re: iTools ambiguity [message #64766 is a reply to message #64693] |
Wed, 14 January 2009 08:10  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
mgalloy@gmail.com writes:
> There are many of the _ classes, I think generally they implement all
> the functionality and then are inherited by a class without the _ that
> also inherits from IDLitComponent.
>
> This is what you get when you use multiple inheritance.
Oh, for goodness sakes! I think I am just going to have
to throw my hands up this week and find something else to
do. :-(
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: iTools ambiguity [message #64769 is a reply to message #64693] |
Wed, 14 January 2009 07:46  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On Jan 13, 10:48 pm, Robbie <ret...@iinet.net.au> wrote:
> The documentation for IDLitDataContainer says that its superclasses
> are IDLitContainer and IDLitData however I attempt the following
>
> obj = obj_new('IDLitDataContainer')
> obj -> IDLitContainer::Add, obj_new('IDLitComponent')
>
> and I get an error. Instead I must do
>
> obj -> _IDLitContainer::Add, obj_new('IDLitComponent')
>
> Evidently the IDLitContainer behaviour has been implemented using
> _IDLitContainer (an abstract class).
>
> This is a somewhat loaded question, but which superclass is correct?
> Is it _IDLitContainer or is it IDLitContainer?
Looking at the source code it appears that _IDLitContainer is the real
superclass that implements the "add" method. IDLitContainer is just a
thin wrapper around _IDLitContainer (and also subclassing
IDLitComponent).
The reason for all those _ classes is multiple inheritance: classes
can't inherit from IDLitComponent twice (the dreaded diamond of death
in the inheritance hierarchy). In this case, IDLitDataContainer
inherits from IDLitData (a subclass of IDLitComponent) and
_IDLitDataContainer. If it inherited from IDLitDataContainer directly
then it would be an error, so an _IDLitContainer class is created
which is all the functionality needed in IDLitContainer, but that
doesn't inherit from IDLitComponent.
So the documentation is telling a "white lie" here, IDLitDataContainer
doesn't inherit from IDLitContainer, but it has all the functionality
as if it did. Of course, depending on what you are doing, this might
really throw you off since it is not true.
There are many of the _ classes, I think generally they implement all
the functionality and then are inherited by a class without the _ that
also inherits from IDLitComponent.
This is what you get when you use multiple inheritance.
Mike
--
www.michaelgalloy.com
Tech-X Corporation
Associate Research Scientist
|
|
|