3 ms·
Babel.js is a transpiler from ES6/7 to earlier versions. https://babeljs.io/ https://babeljs.io/ I mention it because this is currently the only implementation
by jarcane 11y ago
Babel.js is a transpiler from ES6/7 to earlier versions. https://babeljs.io/ https://babeljs.io/
I mention it because this is currently the only implementation that I know of with tail-call optimization (using a trampolining method, I believe), as well as all the other new functional tools in ES6.
This here is a book on ES6, which you'll want Babel for: https://leanpub.com/exploring-es6/read https://leanpub.com/exploring-es6/read
- braythwayt 11y agoBabel performs tail-recursion optimization. It is, as far as I know, impossible to use trampolining to perform tail-call optimization outside of very limited special cases. You need to do either whole-program rewriting--which means rewriting both the original source and every library or module included--or you need control of the engine itself. Whole-program rewriting is very impractical and additionally imposes the trampolining performance penalty on every function and method being invoked. It’s very much like implementing continuations by rewriting in continuation-passing style.
- jarcane 11y agoFair enough. My apologies for the imprecision.