Support tail recursion #242
Replies: 3 comments
-
|
I think the most interesting part of tail recursion/tail calls is not actually tearing down the stack frame early, but rather decrementing the reference counts on local variables early, in order to reduce space consumption and enable more in-placing. And decrefing can happen much earlier than the final call in a definition. E.G. this should be able to work in place: |
Beta Was this translation helpful? Give feedback.
-
|
(also: of course should be togglable, though probably orthogonal to debug mode, as you might want to include debugging without giving up performance) |
Beta Was this translation helpful? Give feedback.
-
|
This should be done by explicit user action. Perhaps a keyword recur. which is 'goto_0' but clearing local variables and setting new x/y. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Tail recursion can be detected when
-- @HenryHRich 13:15, 12 June 2017 (UTC)
Beta Was this translation helpful? Give feedback.
All reactions