On Sat, Apr 30, 2005 at 10:40:12AM +0200, Leopold Toetsch wrote:
> Patrick R. Michaud <[EMAIL PROTECTED]> wrote:
> 
> > I'd appreciate any gentle nudges towards the appropriate documentation,
> > source file, or answer.  Thanks!
> 
> I've now created a test for it in t/pmc/object-meths.t:
> 
>   .sub go method
>       ...
>       P2 = self
>       tailcallmethod "go"
>   .end
> 
> Works. But that's not really optimal. Should the invocant be implicitely
> "self" and/or do we need a more general syntax:
> 
>   .pcc_begin
>     .arg x
>     ...
>     .invocant o
>     tailcallmethod "foo"
>   .pcc_end

For my needs (PGE) I definitely need the ability to have a non-self
invocant and to pass parameters.  

> And maybe even
> 
>    foo(x, ...) @TAIL_CALL      # tail function call
> 
>    o.foo(x, ...) @TAIL_CALL    # tail method call

This would be *really* nice.  I'm assuming here that @TAIL_CALL also
causes the current routine's caller to receive back any return values
from o.foo(x,...) exactly as if this routine had returned it.

I can probably make the .pcc wrappers work when I get to that level
of optimization if that's what we have available.  Just to make sure
I have it right, the code

    (ret) = obj.match(w,x,y,z)
    .return (ret)

then becomes

    # tailcall version of obj.match(w,x,y,z)
    .pcc_begin prototyped
    .arg w
    .arg x
    .arg y
    .arg z
    P2 = obj
    tailcallmethod "match"
    .pcc_end

...?

Pm

Reply via email to