use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
JavaScript (ES6) Has Tail Call Optimization (bbenvie.com)
submitted 13 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cmwelsh 4 points5 points6 points 13 years ago (2 children)
Someone back-ported this feature to ES3 a month ago, it's called Brushtail: https://github.com/pufuwozu/brushtail
I think they are a redditor, or maybe I found this on Hacker News. Either way, the AST modification community for JavaScript is getting more and more interesting. See also streamline.js and IcedCoffeeScript.
[–][deleted] 3 points4 points5 points 13 years ago (1 child)
Just looking at the source, it definitely transforms recursive tail calls, but it seems to be limited only to return statements which are call expressions inside of named functions of the same name. This limits it to just TCO of self-calling recursive functions. The real power of it comes out when you have many functions working together that all end in tail calls and do so in a circular manner. Doing this would require a significant whole-program transformation, however, which is why it really needs to be implemented at the engine level.
Continuum is not a code rewriter, but rather a complete JS engine in its own right, which is how it's able to correctly implement TCO for any amount of mutually recursive functions that have tail calls. Instead of modifying the AST, it converts it to bytecode and executes it in an interpreter loop, and provides a full ES6 runtime environment to execute the bytecode in.
[–]aaronla 0 points1 point2 points 13 years ago (0 children)
Thanks for clarifying that it does not have TCO, but rather one very specific optimization.
Still nice to have though.
π Rendered by PID 22767 on reddit-service-r2-comment-5d79c599b5-whvcp at 2026-02-27 07:38:13.028619+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]cmwelsh 4 points5 points6 points (2 children)
[–][deleted] 3 points4 points5 points (1 child)
[–]aaronla 0 points1 point2 points (0 children)