From: Moritz Lenz <[EMAIL PROTECTED]>
   Date: Tue, 23 Sep 2008 21:39:06 +0200

   . . .

   Now '<a b>.sort' works fine (it didn't before), but 'sort <a b>' fails
   like this:

   SUB sort
   METHOD sort
   No applicable methods.
   current instr.: 'parrot;Any;sort' pc 3090 (src/gen_builtins.pir:2129)
   called from Sub 'parrot;Any;sort' pc 10477 (src/gen_builtins.pir:6568)

   So the sub sort calls the method sort, where it dies, and I have no idea
   why.
   Any thoughts on how I could fix this?

   Moritz

I came up with the following patch to add debugging output a few weeks
ago when trying to understand a similar dispatch failure; it turned out
that I had been defining multis in different packages.  HTH,

                                        -- Bob Rogers
                                           http://rgrjr.dyndns.org/

Index: src/pmc/multisub.pmc
===================================================================
--- src/pmc/multisub.pmc        (revision 31318)
+++ src/pmc/multisub.pmc        (working copy)
@@ -63,8 +63,37 @@
         PMC * const list = Parrot_mmd_sort_candidate_list(interp, SELF);
         PMC *func;
 
-        if (PMC_IS_NULL(list))
+        if (PMC_IS_NULL(list)) {
+            /* add some debugging output. */
+            INTVAL n = VTABLE_elements(interp, SELF);
+            INTVAL i;
+
+            PIO_eprintf(interp, "\nNo MMD candidates in %d variants:\n", n);
+            for (i = 0; i < n; ++i) {
+                PMC * const variant = VTABLE_get_pmc_keyed_int(interp, SELF, 
i);
+                Parrot_sub *sub = PMC_sub(variant);
+                STRING *name = sub->name;
+                PMC *sig = sub->multi_signature;
+                INTVAL n_args = VTABLE_elements(INTERP, sig);
+                INTVAL j, class;
+
+                PIO_eprintf(interp, " %3d:  %Ss(",
+                            i, Parrot_full_sub_name(interp, variant));
+                for (j = 0; j < n_args; ++j) {
+                    INTVAL dispatch_type = 
VTABLE_get_integer_keyed_int(interp, sig, j);
+                    if (dispatch_type >= 0) {
+                        PIO_eprintf(interp, (j == 0 ? "'%Ss'" : ", '%Ss'"),
+                                    interp->vtables[dispatch_type]->whoami);
+                    }
+                    else {
+                        PIO_eprintf(interp, (j == 0 ? "%d" : ", %d"),
+                                    dispatch_type);
+                    }
+                }
+                PIO_eprintf(interp, ")\n");
+            }
             Parrot_ex_throw_from_c_args(INTERP, NULL, 1, "No applicable 
methods.\n");
+        }
 
         func = VTABLE_get_pmc_keyed_int(interp, list, 0);
         return VTABLE_invoke(INTERP, func, next);
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

Reply via email to