Re: Dumb Dumb Question [message #13534] |
Thu, 19 November 1998 00:00 |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Craig Markwardt wrote:
> Liam Gumley <Liam.Gumley@ssec.wisc.edu> writes:
>>
>>
>> "When calling a routine with a keyword parameter, you can abbreviate the
>> keyword to its shortest, unambiguous abbrevation".
>>
>> Cheers,
>> Liam.
>>
>
> I have been bitten by this alot. I have often wanted to have keywords
> like TIME, TIMEBIN, TIMECOL in the same procedure. For some reason
> it's perfectly legal to compile such a procedure, but I can never use
> the "TIME" keyword because it's ambiguous.
>
> I would much prefer that the IDL byte compiler would issue a *warning*
> when an ambiguity like that appears. I think that when a procedure is
> called with "TIME=xxx", and that exact keyword exists, then there
> should be no ambiguity.
>
> Craig
>
> --
> ------------------------------------------------------------ --------------
> Craig B. Markwardt, Ph.D. EMAIL: craigmnet@astrog.physics.wisc.edu
> Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
> ------------------------------------------------------------ --------------
I fully agree! I always run into this problem when I try to specify a PS
keyword to turn postscript output on and a PSFILENAME keyword to direct it
into a specific file....
Martin.
--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------
|
|
|
Re: Dumb Dumb Question [message #13554 is a reply to message #13534] |
Wed, 18 November 1998 00:00  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Liam Gumley <Liam.Gumley@ssec.wisc.edu> writes:
>
>
> "When calling a routine with a keyword parameter, you can abbreviate the
> keyword to its shortest, unambiguous abbrevation".
>
> Cheers,
> Liam.
>
I have been bitten by this alot. I have often wanted to have keywords
like TIME, TIMEBIN, TIMECOL in the same procedure. For some reason
it's perfectly legal to compile such a procedure, but I can never use
the "TIME" keyword because it's ambiguous.
I would much prefer that the IDL byte compiler would issue a *warning*
when an ambiguity like that appears. I think that when a procedure is
called with "TIME=xxx", and that exact keyword exists, then there
should be no ambiguity.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: Dumb Dumb Question [message #13557 is a reply to message #13554] |
Wed, 18 November 1998 00:00  |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
Colin Rosenthal wrote:
>
> This may be really stupid, but is there a way around the following
> feature:
>
> pro x_test,x=x,x2=x2
> if n_elements(x) ne 0 then print, 'x=',x
> if n_elements(x2) ne 0 then print, 'x2=',x2
> end
>
> when I run it with
>> x_test,x=1
> I get
> % Ambiguous keyword abbreviation: X.
> % Execution halted at: $MAIN$
>
> Does this mean no IDL procedure will ever work if one keyword is a left
> substring of another keyword? Can I force IDL to interpret the "x" as "x"
> and not an ambiguous abbreviation for "x2"?
According to the IDL 5.1 online help under 'Building IDL Applications |
Defining Procedures and Functions | Parameters', it says
"When calling a routine with a keyword parameter, you can abbreviate the
keyword to its shortest, unambiguous abbrevation".
Cheers,
Liam.
---
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
1225 W. Dayton St., Madison WI 53706, USA
Phone (608) 265-5358, Fax (608) 262-5974
http://cimss.ssec.wisc.edu/~gumley
|
|
|
Re: Dumb Dumb Question [message #13565 is a reply to message #13554] |
Tue, 17 November 1998 00:00  |
Richard G. French
Messages: 65 Registered: June 1997
|
Member |
|
|
> Does this mean no IDL procedure will ever work if one keyword is a left
> substring of another keyword? Can I force IDL to interpret the "x" as "x"
> and not an ambiguous abbreviation for "x2"?
>
> --
I KNEW that I had run into this problem awhile ago, and I posted
something about it, but I did not realize at the time that the problem
was the left substring. I'm quite sure this is what happened to me.
Thanks for restoring my sanity on this one, since I could not find the
code segment that had caused the problem and I was unable to reproduce
it.
Dick French
Wellesley College
|
|
|
Re: Dumb Dumb Question [message #13568 is a reply to message #13565] |
Tue, 17 November 1998 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Colin Rosenthal (rosentha@asp.hao.ucar.edu) writes:
> This may be really stupid, but is there a way around the following
> feature:
>
> pro x_test,x=x,x2=x2
> if n_elements(x) ne 0 then print, 'x=',x
> if n_elements(x2) ne 0 then print, 'x2=',x2
> end
>
> when I run it with
>> x_test,x=1
> I get
> % Ambiguous keyword abbreviation: X.
> % Execution halted at: $MAIN$
>
> Does this mean no IDL procedure will ever work if one keyword is a left
> substring of another keyword? Can I force IDL to interpret the "x" as "x"
> and not an ambiguous abbreviation for "x2"?
As far as I know, there is no way around this. But would
you believe that with as many IDL programs as I've written,
I've only run into this problem a handful of times. (But
once last week, as a matter of fact.)
Cheers,
David
|
|
|