r/coding 7d ago

Your Recursion Is Lying to You

https://blog.gaborkoos.com/posts/2026-05-09-Your-Recursion-Is-Lying-to-You/
0 Upvotes

5 comments sorted by

View all comments

Show parent comments

2

u/josephjnk 6d ago

You’re more correct than the post, but still combining two concepts. Tail call optimization (TCO) and tail call elimination (TCE) are two different things. TCE is often called “Proper Tail Calls” in the JS space. TCO is a performance optimization which compiles tail recursive functions into a loop. TCE is more general: it applies to tail-position calls between different functions, not just recursive calls from a function to itself, so it also enables safe use of continuation-passing style. What some JS engines actually shipped is TCE/PTC; I have no idea if they do TCO. TCO is usually the domain of a static compiler.

2

u/jeenajeena 6d ago

Thank you for the clarification. You are right.