Re: Evil type coercion
From: Rick Rothstein (rickNOSPAMnews_at_NOSPAMcomcast.net)
Date: 11/02/04
- Next message: Rick Rothstein: "Re: Evil type coercion"
- Previous message: Bob Butler: "Re: Evil type coercion"
- In reply to: Bob Butler: "Re: Evil type coercion"
- Next in thread: Bob Butler: "Re: Evil type coercion"
- Reply: Bob Butler: "Re: Evil type coercion"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 2 Nov 2004 12:51:06 -0500
> > No more or less than VB could itself Bob ;-)
> >
> > I want the expression semantics to be precisely the same as those in
> > the VB language. Hence, the expression evaluation is passive and
> > makes no assumptions. I was simply a bit surprised to find such a VB
> > "glitch". The original problem was reported to me as a problem in my
> > code, so I'm relieved from that point of view.
>
> I'm not totally clear on how your code relates to the original code so
if
> this is an issue for you it may need to be addressed in both. One
thing
> that may be a factor (assuming I've understood what you are doing
> correctly):
>
> Private Sub Main()
> Debug.Print "1" > 9 : false
> tryit "1", 9
> End Sub
>
> Private Sub tryit(ByVal v1, ByVal v2)
> Debug.Print v1 > v2 ' true
> End Sub
Um, I must be missing something obvious. In your Sub, both v1 and v2 are
variants. You are passing variant value into to them ByVal. To me, that
would mean the Variant with the String sub-type would force the copy it
is passing into the 1st Variant argument to a String sub-type and the
Variant with the Integer sub-type would force the copy it is passing
into the 2nd Variant argument to an Integer sub-type. That would seem to
mean that the comparison inside of your Sub should produce the same
result as the comparison back in Main... but it isn't. What am I
missing?
Rick - MVP
- Next message: Rick Rothstein: "Re: Evil type coercion"
- Previous message: Bob Butler: "Re: Evil type coercion"
- In reply to: Bob Butler: "Re: Evil type coercion"
- Next in thread: Bob Butler: "Re: Evil type coercion"
- Reply: Bob Butler: "Re: Evil type coercion"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|