comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » _EXTRA inheritance crashing IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: _EXTRA inheritance crashing IDL [message #30264 is a reply to message #30208] Thu, 11 April 2002 14:51 Go to previous messageGo to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Rob Preece" <Rob.Preece@msfc.nasa.gov> wrote in message
news:Rob.Preece-1104021521040001@biggamma.nsstc.nasa.gov...
>
> I have a *very* good reason for doing it this way (otherwise, why
> bother! ;) I have a set of keywords to pass on to an embedded plot
> routine, and I can't know at the time what their values will be. I
> have a plot zooming function in a widget (object) that simply calls
> the object's 'PLOT' method, passing new x and y ranges. The plot
> method does some stuff, and then hands it all off to the IDL
> (direct) PLOT routine, adding in the 'XRANGE' and 'YRANGE' keywords
> so that they can be overridden when the 'ZOOM' method is
> invoked. Very much like 'test1' in my sample code. Since I followed
> the documentation as Mark H. mentioned, is this a valid bug in IDL?
> How to proceed?

Yes it's a bug. Report it to IDL.

Re the need to do it this way, if you're passing specific keywords
then you don't *need* to use inheritance. Eg this...

PRO test1, _REF_EXTRA=extra
test2, INDGEN (10), _EXTRA = ['TITLE','XTITLE','YTITLE', 'XRANGE']
END

...can be written...

PRO test1, TITLE=title, XTITLE=xtitle, YTITLE=ytitle, XRANGE=xrange
test2, INDGEN (10), TITLE=title, XTITLE=xtitle, YTITLE=ytitle, $
XRANGE=xrange
END

(I note that your original test1 was a little more complicated than
the one I have written. Was there a reason for that?)

If you want to direct different keywords to different routines you can
do this.

PRO test1, TITLE=title, XTITLE=xtitle, YTITLE=ytitle, XRANGE=xrange
test2, INDGEN (10), TITLE=title, XTITLE=xtitle,
test3, YTITLE=ytitle, XRANGE=xrange
END

or even

PRO test1, TITLE=title, XTITLE=xtitle, YTITLE=ytitle, XRANGE=xrange, $
_EXTRA=extra
test2, INDGEN (10), TITLE=title, XTITLE=xtitle,
test3, YTITLE=ytitle, XRANGE=xrange
test4, _EXTRA=extra
END

Defaults can be supplied and overridden for explicit or inherited
keywords, eg:

PRO test1, KEY1=key1, _EXTRA=extra
if n_elements(key1) eq 0 then key1 = 33
test2, indgen(10), KEY1=key1, KEY2=33, _EXTRA
END

The default for key1 is obvious, What's not so obvious is that if I
call

IDL> test1, KEY2=66

then this value is passed to test2, overriding 33.

Warning: if you use this last technique with IDL 5.4 you must use
inheritance by value not reference because there was a bug in 5.4.

Of course with the different bugs in different versions you may well
decide to leave your code as it is and stick with 5.4!

--
Mark Hadfield
m.hadfield@niwa.co.nz Ka puwaha et tai nei
http://katipo.niwa.co.nz/~hadfield Hoea tatou
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Finding the Non-Matching elements in two vectors
Next Topic: Vector Field Plot on Irregular Grid

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Tue Oct 14 17:47:55 PDT 2025

Total time taken to generate the page: 0.23606 seconds