On Mon Jan 05 11:53:29 2009, moritz wrote:
> Carl MXXsak (via RT) wrote:
> > # New Ticket Created by  "Carl Mäsak"
> > # Please include the string:  [perl #61836]
> > # in the subject line of all future correspondence about this issue.
> > # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61836 >
> >
> >
> > Rakudo r34628:
> >
> > $ perl6 -e 'undef min 2'
> > Multiple Dispatch: No suitable candidate found for 'cmp', with
> signature 'PP->I'
> > [...]
> 
> Added tests to t/spec/S03-operators/misc.t (but I don't know what the
> result should be, I just tested with lives_ok).
> 
> Cheers,
> Moritz
> 

Part of this bug fixed in #61840.
Part of this bug related to Parrot absence of VTABLE_cmp for "undef".

Attached patch adds VTABLE_cmp for Undef in Parrot. Other approach is to
add .sub 'cmp' :multi('Failure',_) to Rakudo. I can't judge with one is
better.

-- 
Bacek


commit 948c9412c390b86cf68eaf5cc76525e050a1e100
Author: Vasily Chekalkin <ba...@bacek.com>
Date:   Sat Feb 14 18:24:13 2009 +1100

    Implement Undef.cmp

diff --git a/src/pmc/undef.pmc b/src/pmc/undef.pmc
index ed949a0..0bde497 100644
--- a/src/pmc/undef.pmc
+++ b/src/pmc/undef.pmc
@@ -245,6 +245,25 @@ Returns 1 if the C<*value> is an Undef PMC, 0 otherwise.
     MULTI INTVAL is_equal(DEFAULT value) {
         return 0;
     }
+
+/*
+
+=item C<INTVAL cmp(PMC *value)>
+
+Returns 1 if the C<*value> is an Undef PMC, otherwise delegate comparition to value.
+
+=cut
+
+*/
+
+    MULTI INTVAL cmp(Undef value) {
+        return 1;
+    }
+
+    MULTI INTVAL cmp(DEFAULT value) {
+        return VTABLE_cmp(INTERP, value, SELF);
+    }
+
 }
 
 /*

Reply via email to