I don't understand what you mean by "reuse": if a fn makes multiple non-tail calls it reuses a region of stack for each; and if it finishes with a tail call, it reuses the place its own inbound args went. What am I missing?
-
-
-
The problem is if you tail call a function that takes more argument space than you do.
- 8 more replies
New conversation -
-
-
There are definitely multiple calling conventions possible for tail calls. Rabbit did it differently than almost all compilers today, for example.
-
Yes, and if you think of "guaranteed tail call optimization" as a degenerate case of code from a compiler that CPS transforms before final gen, there's a family of calling conventions even within a single compiler (self recursive, known target, unknown, FV(f)=0 vs. >0, etc.).
End of conversation
New conversation -
-
-
And having to memorize the patterns. Give me growable stacks and I love you. Give me tail calls and maybe I'll think about it sometimes.
-
What's "the patterns"? return f(x) is a tail call, other stuff not so much.
- 7 more replies
New conversation -
-
-
Is this something that could be monomorphized? Or is the issue more to do with the complexity of having multiple calling conventions?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.