# New Ticket Created by  Rob Hoelz 
# Please include the string:  [perl #125135]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=125135 >


When invoking callsame in add_method when making a custom metaclass, callsame 
fails to invoke the next candidate on even-numbered invocations.  Adding an 
explicit return in front of callsame, or a statement after it (ex. say 'hi') 
fixes the issue.  Please consult the attached code.

I dug into the callsame code a bit, and it seems that the same dispatcher 
object is used between calls.  This causes the dispatcher to incorrectly think 
that it is out of candidates on odd-numbered invocations of callsame.  I don't 
know how the dispatcher object is initialized; I would be happy to dig into 
this further if someone could point me in the right direction.
class TestHOW is Metamodel::ClassHOW {
    method add_method(Mu $obj, $name, $code) {
        callsame;
    }
}

my package EXPORTHOW {}
EXPORTHOW::<class> = TestHOW;

Attachment: test.p6
Description: Binary data

Reply via email to