Re: Pass-By-Reference question. [message #38486 is a reply to message #38484] |
Thu, 11 March 2004 02:12   |
Chris Lee
Messages: 101 Registered: August 2003
|
Senior Member |
|
|
In article <405594fa.0403101534.55e8403c@posting.google.com>, "Tim
Robishaw" <timrobishaw@yahoo.com> wrote:
> "Christopher Lee" <cl@127.0.0.1> wrote in message
>> Duplicate keywords give IDL no chance of knowing what to do, hence it
>> complains, and it only looks in the _EXTRA struct if it doesn't find
>> what it wants elsewhere. If you want an option of overriding the nodata
>> keyword, you need to look for it first
> I agree that the best thing to do is to pass NODATA in as an explicit
> keyword in this case. However, I strongly disagree with your
> interpretation that IDL is confused by duplicate keywords in this
> scenario: the point is that keywords passed by reference are advertised
> to override keywords set inside the module (and this is a great thing
> since you can have a default set of keywords that can be superseded by
> user input!) In fact, in the example initially provided, the XRANGE and
> YRANGE keywords are "duplicated" by passing them in by reference and, as
> advertised, the values passed by reference override the values set in
> the call to plot. Anyone have any other ideas?
plot, findgen(10),nodata=0, _EXTRA={nodata:1}
plot, findgen(10), nodata=1, _EXTRA={nodata:0}
both product the same result.
contour, dist(100),/follow, /downhill, _EXTRA={follow:0,downhill:0}
contour, dist(100),follow=0, downhill=0, _EXTRA{=follow:1,downhill:1}
and again...
help, make_array(dimension=[2],value=0.0,double=1,_EXTRA={double:0 })
<Expression> DOUBLE = Array[2]
IDL> help, make_array(dimension=[2],value=0.0,double=0,_EXTRA={double:1 })
<Expression> DOUBLE = Array[2]
and again...
IDL isn't confused?
It has something to do with built in functions and boolean input
variables (or at least, inputs that are considered boolean,
where the keyword is usually set as /flag ).
It doesn't appear to work with user functions, in any combination that I
tried.
Chris.
|
|
|