At 9:12 PM +0000 12/8/03, Pete Lomax wrote:
On Mon, 8 Dec 2003 11:35:59 -0500, Dan Sugalski <[EMAIL PROTECTED]> wrote:



Unqualified eq/cmp/lt are OK for two PMC operations,
I'm not convinced at all here. PMC comparison ops, afaict, are based
solely on the pmc instance/address

Well... no.


Here's a snippet to play with:

        $P1 = new Array
        $P1 = 2
        $P1[0] = 1
        $P1[1] = 1
        $P2 = new Array
        $P2 = 2
        $P2[0] = 1
        $P2[1] = 1
#       eq $P1, $P2, _L3
        eq "fred", "fred", _L3
        print "error \"fred\"!=\"fred\""
_L3:


Is $P1=$P2?

Well... maybe. And maybe not. Heck, even this:


   new P1, .Foo
   set P2, P1
   eq P1, P2, OK

may not branch to OK. (There's no requirement that high-level comparisons require a PMC to be equal to itself)

That's why eq, eq_num, and eq_str for PMC comparisons should call the three versions of equality vtable functions, and the comparison ops should do the same depending on whether they're doing a numeric, string, or generic comparison.

It's important not to confuse these high-level comparisons with lower-level things like PMC address comparisons.
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to