5 ms·
I tried to create an infinite loop in Firefox and got a "InternalError: too much recursion". Then when I tried it in Chrome I got "Uncaught RangeError: Maximum
by current_call 11y ago
I tried to create an infinite loop in Firefox and got a "InternalError: too much recursion". Then when I tried it in Chrome I got "Uncaught RangeError: Maximum call stack size exceeded".
function x() { return x(); }
- Kiro 11y agoI think you misunderstood "now". It's "now" as in ES6/ES2015, not ES5 which the browsers are running by default.
- thomasfoster96 11y agoThat's still expected?
- current_call 11y agoIt's a recursive tail call. It should run forever, like the following Scheme code. (define (foo) (foo)) (foo)
- thomasfoster96 11y agoAh, right, yes I get what you mean. The main problem is still that Chrome and Firefox don't support tail call elimination. Babel (6to5) and Traceur do.
- strmpnk 11y agoThey don't. They support an optimization for self recursive calls but not general tail call elimination.