On Mon, May 19, 2008 at 03:29:33PM -0700, Stephane Payrard wrote:
> # New Ticket Created by  Stephane Payrard 
> # Please include the string:  [perl #54478]
> # in the subject line of all future correspondence about this issue. 
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=54478 >
> 
> Request for enhancement:
> [...]
> 
>   A the Perl6 level,  this could be  a trait 'is :pirtrace'  and and
> 'is :pirtrace<rec>. for functions and methods.
>   :pirtrace would cause subcalls to be wrapped:  trace 0; subcall();  trace 1.
>   :pirtrace would cause a whole method function PIR code wrapped by
> inc_trace and  dec_trace.

Rakudo already offers a "trace" builtin that enables/disables
tracing in Parrot.  I'm not sure it needs to be a trait.

One can implement the equivalent of inc_trace and dec_trace in rakudo 
with something like:

    our $tracevalue = 0;

    sub inc_trace {
        our $tracevalue;
        $tracevalue++;
        trace(1);
    }

    sub dec_trace {
        our $tracevalue;
        $tracevalue-- if $tracevalue > 0;
        trace($tracevalue > 0);
    }

Pm

Reply via email to