v = 0.5
if (v > 0) then
msgBox "This will not be displayed"
end if
Makes sense to me -- you're comparing to an integer, so the variant
assumes an integer.
if (v.doubleValue > 0) then
msgBox "This will be displayed"
end if
Again, makes sense because you're being explicit.
if (0 < v) then
msgBox "This will not be displayed either"
end if
Same as above.
if (v > 0.0) then
msgBox "But this will be"
end if
Same as above.
Whups. The compare should be converting the parameters to the most
precise type. Instead, if one of them is a variant, it is converting
the variant to the same type as the other parameter.
No, they are converting to the type you are comparing to, which is
intended beavior.
Looking very carefully at the documentation, I find this is mentioned in
passing at the very bottom of the variant explanation. However, a
landmine like this needs to be redflagged with a big "Danger Will
Robinson!" message and an example of what not to do.
It's a sensible behavior, but you're right, it could be documented a
little clearer.
~Aaron
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|