tail recursion
Doug McIlroy <[email protected]> Tue, 04 Jul 2017 10:10:15 -0400
| Newsgroups | gmane.comp.gnu.m4.general |
|---|---|
| Message-ID | <[email protected]> |
I have been writing a lot of recursive m4 macros lately, and
have been disappointed to see that m4 doesn't recognize tail
calls and drop the dead stack frame when one occurs. A vivid
example is to watch memory usage for this trivial example.
define(x,`x')
x()
It needlessly eats about 100KB/sec on my Surface netbook.
I suspect someone who knows the code could implement
tail-call optimization easily. So before I dive in to
try to figure out how to do it myself, I ask is there
a pro out there who might like to do it?
Doug