| Re: Interesting WHERE function gotcha [message #34014 is a reply to message #33936] |
Mon, 10 February 2003 10:28  |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Mon, 10 Feb 2003 10:21:46 -0700, Stein Vidar Hagfors Haugan wrote:
> JD Smith <jdsmith@as.arizona.edu> writes:
>
>> On Thu, 06 Feb 2003 19:35:31 -0700, Craig Markwardt wrote:
> [...]
>> Yes, the tension between single element arrays and scalars is felt
>> deeply, even within the core IDL development group. It's a regrettable
>> legacy which must, unfortunately, be preserved for compatibitlity.
>> There are, however, minor changes and improvements: e.g., with v5.6,
>> KEYWORD_SET now considers a single element array TRUE only if its
>> single element is non-zero; i.e. it's treated just like a scalar for
>> this (and only this) function.
>
> Uh... improvement? I beg to differ. Not only does it introduce a single
> mysterious case where the legacy compatibility fails (when someone
> relies on the previous truth that "when it's defined as an array, it's
> set!") (I hope I never have to debug a code experiencing this!), but it
> introduces even one more level of exception to how singular arrays are
> treated.... Okay, so trailing singular dimensions are disappearing or
> are ignored, except when it's the last dimension to survive the
> slaughter, *except* that this one nifty function that we wrote
> specifically to say that anything not a scalar zero means "set" is right
> now doing a vote on whether to consider your singular dimension worthy
> of noticing... Ugh..!
Notice I said "changes and improvements". You pick which is
applicable ;). The truth is, I was once told by a top RSI developer,
"If I were designing IDL over, there would be no scalars, just arrays
of various dimensionality." Given that we can't go back there, I'm
not sure which is better, lots of little workarounds, or just living
with the pain. I for one tend to throw a lot of [0] indexing
statements in for good measure.
JD
|
|
|
|