I have been reading alot about Perl's compilation stage (mostly in the Camel book), and looking at various modules that seem to manipulate the op_code tree and other internal aspects of Perl. All this is fascinating to me, as I cannot think of any other language which gives you this much ability to play and/or shoot yourself in the foot.
Being a fan of functional programming (of the LISP, SCHEME & ML varieties), I love the elegance of a recursive algorithm. But being a Perl programmer by trade, I find the inefficiency of recursion to be a problem, and end up having to code the less elegant imperative versions. Which brings me to my question(s).
Has anyone ever tried to implement tail recursion in Perl? Either in the interpreter code itself, or through the manipulation of the op_code tree? Would it even be possible given whats available?
I look at things like Stackless Python and drool at its virtually unlimited recursion and freedom from the C stack. And the ML compilation model (which I only barely understand), but which seems to almost be devoid of a stack entirely and operate on a more heap-ish paradigm.
Oh yeah, and lastly, if anyone can point me to some good resources on manipulating Perl's internals/op_code (preferably from Perl not from C) that would be HIGHLY appreciated.
Happy New Year to all!
-stvnIn reply to Tail Recursion in Perl by stvn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |