Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Tail Recursion in Perl

by Elian (Parson)
on Dec 31, 2003 at 21:29 UTC ( #318016=note: print w/replies, xml ) Need Help??


in reply to Tail Recursion in Perl

Note that the functionality of stackless python's been in perl 5 since the very beginning -- perl 5 is already stackless in the 'stackless python' sense. The recursion limit is entirely arbitrary, and could be changed or removed if you want. It's only in there now under the assumption that when things get that recursive it's an error, which you could, if you wanted, change.

Replies are listed 'Best First'.
Re: Re: Tail Recursion in Perl
by stvn (Monsignor) on Dec 31, 2003 at 22:17 UTC
    Interesting.

    Pray tell, how could you change it? (The recursion limit that is)

    And you say that perl is stackless in the 'stackless python' sense, so am I to assume that Perl's stack is not tied to the 'C' stack?

    I suppose too that stackless python maybe wasnt the best example since its unlimited recursion does not mean 'efficient' recursion.

    -stvn
      Pray tell, how could you change it? (The recursion limit that is)

      You don't change it - it's already infinite (well, up to the size of available virtual memory.) Of course, there's a warning you usually get when the recursion gets 100 deep, but that can be turned off with no warnings;

      And you say that perl is stackless in the 'stackless python' sense, so am I to assume that Perl's stack is not tied to the 'C' stack?

      Correct. There are a few things in Perl that can blow the C stack (such as certain pathological regexes), but mostly you're only limited by available memory.

      Dave M

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://318016]
help
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2021-07-26 01:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?