Re: something like perl's 'require 5.4' [message #24691 is a reply to message #24689] |
Tue, 17 April 2001 12:44   |
Paul van Delst
Messages: 364 Registered: March 1997
|
Senior Member |
|
|
JD Smith wrote:
>
> Craig Markwardt wrote:
>>
>> Vapuser <vapuser@catspaw.jpl.nasa.gov> writes:
>>> How about:
>>>
>>> version=strupcase(strjoin(strsplit(!version.release,'[.-_]', /extract), ""))
>>> input_version=strupcase(strjoin(strsplit(desired_release,'[. -_]',/extract), ""))
>>> if version lt input_version then 'eeek'
>>>
>>> Clearly `desired_release' would have to be input as a string.
>>>
>>> Of couse, this method 'requires' IDL 5.3 (IIRC), to get the regular
>>> expression semantics of strsplit. The other question is will RSI use
>>> any separator in version designations besides these three?
>>
>> Umm, I never thought I'd be saying this, but aren't these a bit
>> overengineered? I have found that in 95% of the cases the DOUBLE
>> compare will work, and in 4% of the cases the STRING compare will
>> work.
>
> *cough*
>
> <REITERATE>
>
> IDL> print, double('5.4.1') gt 5.4
> 0
>
> </REITERATE>
wot about
IDL> print, double('5.4.1') ge 5.4d0
1
?
Doesn't assuage your other concerns regarding the significance of the last digit however.
I use comparisons like the above for code that contains BREAK, CONTINUE, SWITCH, etc
statements. Or similar for the version in which pointers and objects were introduced (5.2?
can't remember).
I think it would be pretty difficult (for unsophisticated ol' me) to maintain code that
contains version tests for when RSI fixes a bug -- like in the examples you listed....
although, HISTOGRAM and REBIN? Never use 'em. :o) What _possible_ use could they be??
(*).
paulv
(*) sarcasm alert for the irony impaired
--
Paul van Delst A little learning is a dangerous thing;
CIMSS @ NOAA/NCEP Drink deep, or taste not the Pierian spring;
Ph: (301)763-8000 x7274 There shallow draughts intoxicate the brain,
Fax:(301)763-8545 And drinking largely sobers us again.
paul.vandelst@noaa.gov Alexander Pope.
|
|
|