in reply to Re^9: Specializing Functions with Currying
in thread Specializing Functions with Currying

Tail recursion has a seldom-noted cost. Sure, it speeds up some recursive code. But it also means that if you get into trouble, a stack backtrace will be missing a lot of potentially useful context.

That said, you can manually do tail-recursion in Perl with goto. Unfortunately it is not as efficient as it should be, and I'm not entirely sure why.

  • Comment on Re^10: Specializing Functions with Currying

Replies are listed 'Best First'.
Re^11: Specializing Functions with Currying
by stvn (Monsignor) on Aug 07, 2004 at 00:06 UTC
    That said, you can manually do tail-recursion in Perl with goto. Unfortunately it is not as efficient as it should be, and I'm not entirely sure why.

    I think that it basically comes down to the fact that goto is just not all that efficient, and the amount of bookkeeping code needed to do that (for non-trivial implementations) outweighed the benefits.

    -stvn