Re: Evil type coercion

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Russ Holsclaw (russ_at_holsclaw.nyet)
Date: 11/02/04


Date: Tue, 2 Nov 2004 12:01:19 -0700


> Try reading the original posts Russ, especially my reply to Bob!
>
> This code has to "fly blind" as it's servicing an evaluation stack, and
> has
> no intimate knowledge of what the original expression was trying to
> achieve.
>
> Your contribution doesn't help one iota as I believe everything in this
> thread *has* read the manual, many times

Sorry, but in your original post, nor in the replies, was there any mention
of the special rule concerning comparing strings and numerics contained in
variants. Instead there was speculation about the possiblility that some
sort of coerced conversion was done that converted the numeric to a string
with a leading space.

The help text I quoted points out that no coerced conversion is involved at
all, but that there is a simple rule that says that when variants
containing strings and numerics are compared, the numeric is ALWAYS
considered to be the lesser.

The "leading space/STR$()-like" theory wouldn't explain, for example why a
variant containing a zero-length string still comes out as > all numeric
types, regardless of sign or magnitude.

I think it's pretty obvious that none of you were aware of the rule I
quoted until I posted it, indignant denials notwithstanding. Even the
subject-line says that you considered it to be a type coercion, when
actually you were the unwitting victim of a rule in which no type coercion
is involved.

To be sure, your confusion is understandable. After all, the rule I found
doesn't make a lot of intuitive sense, and came as much of a surprise to me
as anyone else. Part of my surprise comes from the fact that Microsoft
actually spelled out the rules in such detail, rather than relying on
programmers to guess at them via trial-and-error, as they seem accustomed
to do these days.

Sorry to have tweaked your nose so tactlessly, but I still maintain that
your nose was tweakable on the basis of the discussion up to that point.



Relevant Pages

  • Re: A nongeneric bounded string array type (in database code)
    ... > and all numerics must be marshalled into and out of strings, ... Of course, I don't use strings for numeric data, and when I use ... Quality is scientific reality. ... -- from Zen and the Art of Motorcycle ...
    (comp.lang.ada)
  • Re: Sorting help
    ... manipulated as numerics, and sorted as numerics. ... Subject: Sorting help ... What is the best way to sort such an array of strings? ...
    (comp.lang.ruby)
  • Re: Replacing specific text within a table cell
    ... Textranges contain strings, never numerics. ... "Barb Reinhardt" wrote: ... Steve Rindsberg, PPT MVP ...
    (microsoft.public.powerpoint)
  • Re: Data Type Change while using FSO?
    ... treat them as strings. ... So, you need two AddSQL functions, or an additional ... argument that tells what type of delimiter (nothing for numerics, ... I receive a data type mismatch error on import. ...
    (microsoft.public.inetserver.asp.general)
  • Re: Defence Research Paper
    ... strings that would undoubtedly be attached. ... all  but I am concerned that some young people gets loads of help from ... Sorry Gags I appear to be repeating myself the original posts ... YIS Tony ...
    (uk.rec.scouting)