[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: something like perl's 'require 5.4'



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>


So I guess what you really you mean that in 95% of cases you don't care
about the (possible) last digit on the version number.  This is fine,
just say so.  Here's a good example of when that last digit matters,
from the "What's New in IDL 5.2.1":

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
The lib/compat directory containing the following obsolete date/time 
routines which are not Y2K compliant has been removed from the IDL 
distribution. 

<SNIP>

REBIN Function Data Types Added:
--------------------------------
The REBIN function now accepts 16-bit unsigned, 32-bit unsigned long, 
64-bit long, or 64-bit unsigned long integer data types.
...

<SNIP>

HISTOGRAM Function Error with BINSIZE Set Fixed:
----------------------------------------------------
The HISTOGRAM function error resulting when the BINSIZE keyword is set 
has been fixed in this release.
...
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

I like your even simpler string compare method, but this one just
doesn't work as advertised.

JD