5 ms·
> Duktape also supports proper tail calls which v8 and spidermonkey refuse to support What are the reasons given for not supporting tail calls?
by herbstein 7y ago
> Duktape also supports proper tail calls which v8 and spidermonkey refuse to support
What are the reasons given for not supporting tail calls?
- hajile 7y agov8 used to support them behind a flag. Chakra and spidermonkey teams said implementing was hard. v8 team put forward a plan to replace automatic PTC with syntactic PTC. The proposal has been essentially dead and v8 removed their PTC support completely. A big complaint was "no stack traces". This doesn't matter (IMO) because shadow stacks have been prove to work well in Safari and in several Scheme implementations (you seldom need more than the first few stacks and the last few stacks with a rolling window). We've had way worse than that for decades now as you lose your whole stack every time the event loop goes to the next event. Safari has about 30% of the total JS marketshare including mobile. They've been running PTC on websites for a couple years without complaints, so the whole "we'll break the web" concerns seem overblown. My understanding of the politics is that both the Safari and spidermonkey/v8 members on the consortium refuse to budge so there isn't consensus to move forward. This still seems a non-issue to me though. If you view PTC as an optional enhancement, then you could still add a non-optional syntactic PTC variant.
- nosianu 7y agoJust an aside regarding stacktraces: In all somewhat recent V8 using engines such as Chrome or node.js you get a "zero-cost" full asynchronous stacktrace these days. That's independent of the async. stacktrace provided through the dev.tools for a long time and "always on" for free. The condition: You must use async/await. Even if you return a promise from a function, for that function to be included in the stacktrace is that you "return await thePromise;". Because of the await the context of the function calling an asynchronous function remains available and can be (and now is) used to create the stacktrace. The Firefox JS engine does not have that feature (yet?) last time I checked.