How to override invoke?

Florian Hatat mininet at wanadoo.fr
Tue Dec 30 11:25:39 UTC 2008


Will Coleda a écrit :
> Thanks for fleshing out this idea, though: I think it reinforces that
> 'self' is not acting as expected for this particular override, and we
> can probably convert this thread into a ticket with a failing test to
> demonstrate it.
>   

Since I am also completely stuck with this issue, I agree. :)

This was already pointed out in
http://rt.perl.org/rt3/Public/Bug/Display.html?id=47674#txn-437200 and
it also happens without overriding: we just cannot use "invoke" with
objects.

.sub main :main
    .const 'String' hello = "Hello World"

    $P0 = new 'MyProc'
    $P0(hello)
.end

.namespace ['MyProc']

.sub class_init :anon :init
    $P0 = newclass 'MyProc'
.end

.sub invoke :vtable :method
    .param pmc message
    .local pmc p
    say "I have to say:"
    say message
    say "That's all folks!"
.end

"invoke" correctly expects one argument, but gets none: this might just
come from compilers/imcc/pcc.c, lines 712 and 746. The rule "the_sub" in
compilers/imcc/imcc.y doesn't set "cur_obj" when there is no dot in the
call, so that the tests on sub->pcc_sub->object in pcc.c yield false.

-- 
Florian,
http://openweb.eu.org/
http://www.linux-france.org/


More information about the parrot-dev mailing list