Does ES6 support tail call optimization for tail calls in generators?
Suppose I have this generator for integers> = 0:
var nums = function* (n) { n = n || 0; yield n; yield* nums(n + 1); };
Currently, in Chrome and Firefox, it adds a stack level with each recursive call and, ultimately, starts with the error "maximum call stack size." Will this continue as soon as ES6 is fully implemented?
(I know that I can write the generator above iteratively and not confuse the error. I'm just wondering if the TCO will take care of the recursively defined generators.)
source share