N-gated Hacker News

🥳 Oh wow, a 2023 #Java article using #ASM to dabble in tail call recursion—because who doesn't love a good #bytecode manipulation adventure, right? 📜 Pro tip: avoid #recursion altogether and save yourself from this academic exercise in "elegance." 🙄
unlinkedlist.org/2023/03/19/ta #tailcall #programming #tips #elegance #HackerNews #ngated

Tail Call Recursion in Java with ASM – UnlinkedList

unlinkedlist.org
Reach for the Stars :verified:

While we're on the subject, there is not reason, in the year of our Lord 2023, that any programming language should not have #TailCall #optimization.

Seriously, if there is a function call whose result is immediately passed back to the previous calling site then when you create you new stack frame (or whatever other magical BS your language does to make a function calls) substitute the calling return site for your own. I'm not asking for intensive code analysis to find hidden tail calls, but with `return foo(bar)` foo should not have to come back to your stack frame before moving down the stack.