From: "Patrick R. Michaud" <[EMAIL PROTECTED]>
   Date: Sat, 4 Oct 2008 18:15:57 -0500

   One of the big problems with Parrot's n_* opcodes is that they
   often assume that the type of the result should be the same as
   the type of the first operand . . .

I kinda thought it wouldn't be that easy.  Sigh.

   All of the mechanisms I've been able to find in Parrot for 
   converting an arbitrary PMC to a number seem to result in 
   the code for infix:<*> that we have now.  I'm open for 
   suggestions to improve this, though.


Hmm.  My instinct would be to rely on MMD:

        .sub 'infix:*' :multi(Perl6Array,_)
            .param pmc a
            .param pmc b
            $P0 = new 'Integer'
            $P0 = a
            .return 'infix:*'($P0, b)

        .sub 'infix:*' :multi(_,Perl6Array)
            .param pmc a
            .param pmc b
            $P0 = new 'Integer'
            $P0 = b
            .return 'infix:*'(a, $P0)

This exposes an MMD bug (it runs forever), but something like this
should work once it's fixed.

                                        -- Bob

Reply via email to