Re: Local procedures and objects [message #17533] |
Sat, 30 October 1999 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Karri Kaksonen (karri.kaksonen@picker.fi) writes:
> If you create two objects thet both have a procedure with the
> same name:
>
> complexPlot__define.pro:
> pro dummydata
> ...
>
> histoPlot__define.pro:
> pro dummydata
> ...
>
> gui__define.pro:
> function gui::Init,
> self.complexPlot = obj_new('complexPlot')
> self.histoPlot = obj_new('histoPlot')
>
> Then obviously "pro dummydata" is defined twice and you get
> problems.
>
> The interesting part is that the first time you start this
> everything appears normal.
>
> The second time you start it you cannot create a new
> instance of complexPlot.
>
> help, /heap is empty
> retall, reset etc. don't help
>
> It is just impossible to do a o=obj_new('complexPlot')
> even from a command line. You just get a null pointer
> without any error messages or clues of what goes wrong.
Humm. I can't seem to reproduce this behavior with
a simple test case. I'm running IDL 5.2.1 on Windows NT.
Do you have a simple case we could try?
> Is there a way to create procedures that are private
> to an object? It may be confusing to write private
> routines as public methods ( pro complexPlot::dummydata )
I think I may be using the opposite definition of
"public" and "private" than you are, but in any
case, there is no strict notion of a "private" or
"public" method in IDL. I typically think of procedures
and functions that exist in an IDL subdirectory and
which can be run from the command line as "public" and
utility routines that are included with other program
modules and are inaccessible from the IDL command line
(without first compiling some other file) as "private".
I take some pain to make sure my "private" procedures
and functions have unique names. Usually by giving
them the "root" name of the command I'm trying to
use: PRO DOIT_GETDATA, data, PRO DOIT_DISPLAY_DATA,
etc.
IDL> DOIT
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|