|
|
Re: Passing objects and parenthesis... doing something wrong here? [message #82680 is a reply to message #82679] |
Wed, 09 January 2013 08:47  |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Wednesday, January 9, 2013 5:35:01 PM UTC+1, Chris Torrence wrote:
> Hi Helder,
>
>
>
> This was a bug, but has now been fixed. However, looking at my change log, it looks like it was fixed for IDL 8.2.
>
>
>
> Is it possible that you are running either IDL 8.1, or a beta version of IDL 8.2?
>
>
>
> If you want, try the following code:
>
>
>
> pro test_junk::mymethod
>
> o1 = obj_new('idlgrplot')
>
> o1.symbol = obj_new('idl_container')
>
> print, o1.symbol.nlist
>
> ; % Attempt to call undefined method: 'IDL_CONTAINER::GetProperty'.
>
> end
>
>
>
> pro test_property_on_object
>
> a = {test_junk, field1: 0}
>
> a = obj_new('test_junk')
>
> a->mymethod
>
> end
>
>
>
> If you get a syntax error when you save and run this, then you must be running an older version of IDL.
>
>
>
> Hope this helps!
>
>
>
> -Chris
>
> ExelisVIS
>
> p.s. you actually don't need to have a cleanup method for these objects, or call obj_destroy, because the automatic garbage collection will take care of it. :-)
Hi Chris,
thanks for the answer... my heart starts beating again. I get an error with your code on my laptop:
% Expression must be a structure in this context: <OBJREF (<ObjHeapVar4(IDL_CONTAINER)>)>.
% Execution halted at: TEST_JUNK::MYMETHOD 4 F:\Test\testobjects.pro
% TEST_PROPERTY_ON_OBJECT 11 F:\Test\testobjects.pro
% $MAIN$
I'm running IDL 8.2.0, Build id: 20120410 (from the help window).
I guess this is a beta version and tonight I will update. At least I know that the code I've written does not need major rewriting/mending...
Thanks again.
Cheers,
Helder
|
|
|
Re: Passing objects and parenthesis... doing something wrong here? [message #82681 is a reply to message #82680] |
Wed, 09 January 2013 08:42  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Chris Torrence writes:
> p.s. you actually don't need to have a cleanup method for these objects, or call obj_destroy, because the automatic garbage collection will take care of it. :-)
Although, I would argue that if there is even a remote possibility that
your code might escape your office, that failure to have a Cleanup
method will make you vulnerable to considerable embarrassment. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: Passing objects and parenthesis... doing something wrong here? [message #82682 is a reply to message #82681] |
Wed, 09 January 2013 08:35  |
chris_torrence@NOSPAM
Messages: 528 Registered: March 2007
|
Senior Member |
|
|
Hi Helder,
This was a bug, but has now been fixed. However, looking at my change log, it looks like it was fixed for IDL 8.2.
Is it possible that you are running either IDL 8.1, or a beta version of IDL 8.2?
If you want, try the following code:
pro test_junk::mymethod
o1 = obj_new('idlgrplot')
o1.symbol = obj_new('idl_container')
print, o1.symbol.nlist
; % Attempt to call undefined method: 'IDL_CONTAINER::GetProperty'.
end
pro test_property_on_object
a = {test_junk, field1: 0}
a = obj_new('test_junk')
a->mymethod
end
If you get a syntax error when you save and run this, then you must be running an older version of IDL.
Hope this helps!
-Chris
ExelisVIS
p.s. you actually don't need to have a cleanup method for these objects, or call obj_destroy, because the automatic garbage collection will take care of it. :-)
|
|
|