Re: Method Overrides [message #80397] |
Wed, 06 June 2012 08:13 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Matthew Argall writes:
> Nope. I am using "compile_opt idl2" (not hidden) as David recommended. Still at run-time I see only
>
> % Compiled Module: CLASS__DEFINE.
>
> But if I do
>
> IDL> help, /source
>
> then I see that all of the modules have been compiled. However, as I said, I do not get the expected results until the second time I run the program. There are no further "% Compile Module:" messages the second time.
>
> I am using IDL 8.0 if that makes a difference.
Is the superclass object written "correctly" (i.e., with
the modules in the proper order)?
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Method Overrides [message #80398 is a reply to message #80397] |
Wed, 06 June 2012 07:41  |
Matthew Argall
Messages: 286 Registered: October 2011
|
Senior Member |
|
|
> Are there any more "% Compiled module:" messages on the second run?
Nope. I am using "compile_opt idl2" (not hidden) as David recommended. Still at run-time I see only
% Compiled Module: CLASS__DEFINE.
But if I do
IDL> help, /source
then I see that all of the modules have been compiled. However, as I said, I do not get the expected results until the second time I run the program. There are no further "% Compile Module:" messages the second time.
I am using IDL 8.0 if that makes a difference.
|
|
|
Re: Method Overrides [message #80403 is a reply to message #80398] |
Tue, 05 June 2012 21:19  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Matthew Argall writes:
> I used "help, /source" and all of the methods are being compiled at
> run-time, but my program does not produce the expected results until
> the second time I run it. Is there a reason for this?
I would put "compile_opt idl2" in all your methods,
and once you get the havoc that will cause sorted out,
I'll bet this problem will have disappeared. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Method Overrides [message #80404 is a reply to message #80403] |
Tue, 05 June 2012 21:03  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 6/5/12 7:55 AM, Matthew Argall wrote:
> I used "help, /source" and all of the methods are being compiled at
> run-time, but my program does not produce the expected results until
> the second time I run it. Is there a reason for this?
Are there any more "% Compiled module:" messages on the second run?
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
|
|
|
Re: Method Overrides [message #80405 is a reply to message #80404] |
Tue, 05 June 2012 06:55  |
Matthew Argall
Messages: 286 Registered: October 2011
|
Senior Member |
|
|
I used "help, /source" and all of the methods are being compiled at
run-time, but my program does not produce the expected results until
the second time I run it. Is there a reason for this?
|
|
|
Re: Method Overrides [message #80413 is a reply to message #80405] |
Mon, 04 June 2012 12:49  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 6/4/12 1:20 PM, Matthew Argall wrote:
> Hi,
>
> I have a set of IDL objects and am running into method overriding
> problems at run-time. Any time I invoke a sub-class at run-time
> without explicitly compiling it before-hand, the class definition
> method gets compiled and executed, but not the over-riding methods.
> The super-class's methods still get used.
>
> All methods are in the same file before/above the object definition
> method (__define), so I thought they would be compiled and recognized
> at the same time, but apparently not as I expected.
This should work as you are expecting.
> At run-time, I see
> % Compiled module: CLASS__DEFINE
>
> But if I compile it myself
> IDL> .compile class__define
> % Compiled module: CLASS__DEFINE::METHOD1
> % Compiled module: CLASS__DEFINE::METHOD2
> % Compiled module: CLASS__DEFINE::METHOD3
> % Compiled module: CLASS__DEFINE
Are you using "compile_opt hidden" in the methods? Otherwise, I'm not
sure why this would be from what you are describing. Are you sure you
are getting the correct source code file, not an old one? Use "help,
/source" to see what has been compiled in your current IDL session.
> Could some one explain to me a little more clearly when or in which
> order to compile sub-classes and super-classes? Every time I use an
> over-riding method, do I either have to compile it or use the "obj ->
> classname::method" syntax to ensure that I get the right one?
You shouldn't ever have to manually compile things if you have named
them correctly. You also shouldn't have to use obj->classname::method
unless you are trying to get the superclasses' method.
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
|
|
|