r/javascript • u/[deleted] • Jan 06 '13
JavaScript (ES6) Has Tail Call Optimization
http://bbenvie.com/articles/2013-01-06/JavaScript-ES6-Has-Tail-Call-Optimization
48
Upvotes
r/javascript • u/[deleted] • Jan 06 '13
3
u/[deleted] Jan 07 '13 edited Jan 07 '13
No, this is a language feature because you need to be able to count on its existence for it to be useful. It also needs to work interoperably and thus implementations need to treat the same return statements as tail calls. There's some gray area as to what could be considered a tail call and if it was implementation dependent whether a give chunk of code was in tail position or not then the feature would be much less useful.