Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I have not found Moritz's code for the man or boy test. My try with the last revision goes to 9. It reaches max recursion depth for 10. Here it is:

    sub A($k is copy, $x1, $x2, $x3, $x4, $x5) {
    my $B = sub { A(--$k, $B, $x1, $x2, $x3, $x4) };
    $k <= 0 ?? $x4() + $x5() !! $B();
    say A(9, sub{1}, sub{-1}, sub{-1}, sub{1}, sub{0} );

    What is the need for & sigil you mention? I have done by hand some crude tailcall optimization in the generated PIR and it reaches the recursion depth limit on 13

    • I have not found Moritz's code for the man or boy test.

      Moritz's test is here: []

    • You don't have to use the & sigil, but if you do (e.g. sub foo (&x) { ... }) then you can call the sub just as x() within the sub foo.

      It's not surprising that implementing the tailcall optimization helped. I suspect we need to be a tad careful when choosing to emit such things in the compiler, since it may screw up the CALLER pseudo-package...not thought too much about the full implications of this for optimization yet though and it may or may not turn out to matter...