http://www.perlmonks.org?node_id=698739


in reply to Recurse using goto; Bug?

That's interesting. In neither place do I find a terminating condition for the recursion so, theoretically, they both should run forever.

I have a separate question -- if you're going to use tail-recursion, anyway, why don't you just use iteration? If I understand things, correctly, you can only do tail-recursion with the 'goto &label' method.

Update: I added some clarification.

--
Wade

Replies are listed 'Best First'.
Re^2: Recurse using goto; Bug?
by ikegami (Patriarch) on Jul 18, 2008 at 22:05 UTC

    The issue wasn't whether it will run forever or not, but whether it would run out of memory or not. The OP is of the opinion that the memory usage of both snippets should be constant, while it's only the case for the second snippet.

      You're absolutely right, of course. The two should be identical. As it is, one of the snippets is silly and the other is silly and sucks up all memory. I sit, corrected. 8o).

      --
      Wade