Re:SICP Goodness – Why you don't need looping constructs
by kccqzy on Friday June 29, 2018 @06:45AM
(#17423707)
ES6 used to mandate TCE but it was removed. No browser other than Safari implements TCE for JavaScript. Apparently the main reason is an inaccurate stack trace on exception.
[ Parent
| on HN ]
Re:SICP Goodness – Why you don't need looping constructs
by hajile on Friday June 29, 2018 @10:20AM
(#17424653)
The latest spec still talks about tail call optimization. The big objection was to replace implicit tail calls with a syntax to specify functions that might tail call.
With TCO being part of the spec and the potential replacement spec killed off, browsers really need to start getting with the program.
JavascriptCore (safari), Node v6, duktape, jerryscript, XS6, etc all have proper tail calls. It breaks the community to not implement them. It's not a standard if its not standard.
Re:SICP Goodness – Why you don't need looping constructs
by soegaard on Saturday June 30, 2018 @03:36PM
(#17432374)
Explicit or implicit doesn't matter for compiling to JavaScript. Explicit tail calls are much better that no tail call support at all.
Re:SICP Goodness – Why you don't need looping constructs
by hajile on Sunday July 01, 2018 @05:03PM
(#17437570)
I agree, but the companies behind explicit calls dropped it, but are refusing to implement the current spec too. Their stupid politics endanger the js ecosystem.
Re:SICP Goodness – Why you don't need looping constructs
by bjoli on Friday June 29, 2018 @08:45AM
(#17424160)
I can understand that, but it is a shame they didn't chose to do so for self-recursing functions. That would at least tell you the stack trace up until that point.
Re:SICP Goodness – Why you don't need looping constructs
by soegaard on Saturday June 30, 2018 @03:34PM
(#17432369)
An often over-looked point: If you use tail calls to implement a loop, you aren't really interested in seeing the stack trace. Compare with a standard for-loop: you aren't interested in seeing all states of the for-loop in a stack trace.