Object Programming [message #75967] |
Wed, 11 May 2011 12:04  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
I guess it has been awhile since I did some extensive
object programming, but goodness, IDL doesn't like it
when you make mistakes!
I suppose I crashed IDL 25-30 times already today, both
IDL 7.1.1 and IDL 8.1. It seems as though if put a breakpoint
in an object program and then do a .RESET from the IDL
command line that IDL is certain to crash.
The error I was tracking down looked something like this:
FUNCTION foo, x, y
obj = Obj_New('foo', x, y)
RETURN, obj
END
Both routines are written in such a way that you can
pass one or two parameters. If I pass a single parameter:
IDL> obj = FOO(data)
The object INIT method was reporting that I was
passing *two* parameters (I was checking with N_Params())
and my program was getting into trouble because I assumed
y was defined in the code. It was actually passing an
undefined variable into the object INIT method. Is this
how IDL has always worked? I could have sworn I've done
this many, many times in the past without difficulty, but
perhaps I wasn't using N_Params() to check parameters
in that code.
Anyway, lesson for today: Don't make a mistake when you are
writing IDL object programs!
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.")
|
|
|