On May 30, 2009, at 1:35 PM, Joe Strout wrote:
Michael Diehr wrote:
dim o1,o2 as object
o1 = v1.objectValue
o2 = v2.objectValue
if o1 = o2 // still doesn't call the Operator_Compare
That's because Object doesn't have an Operator_Compare.
Keep in mind that comparisons are compiled at, er, compile time.
So, for a comparison operator to be invoked, it must be something
the compiler can know about at that time -- i.e., something defined
on the static type of the object references involved.
Ok, but then how/why does Operator_Convert work? Wouldn't the same
issue hold?
The compiler can't know in advance that the object a variant's holds
is a myClass with an operator_convert as string, so obviously it's
checking the class type at runtime and calling it.
If it's magic compiler pixie dust -- I wonder if we could get that
magic applied to Operator_Compare() for Variants?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|