3 ms·
>Still disappointed that Node has backed out of optimized tailcalls, which is part of the ES6 spec. I think it's the only part they haven't implemented. Node d
by coldtea 9y ago
>Still disappointed that Node has backed out of optimized tailcalls, which is part of the ES6 spec. I think it's the only part they haven't implemented.
Node doesn't implement JS features. V8 does and Node gets updated to newer V8 releases every while. Node doesn't have much say in whats gets to v8.
>I think a lot of the pushback I'm seeing against TCO comes from traditional programmers who don't like functional programming and who think that recursion shouldn't play any role in production software. I get that there are also some who have legitimate implementation concerns, but the reflexive pushback TCO gets from a lot of the V8 maintainers compared to any other new ES6 feature seems telling to me (correct me if I'm wrong here).
You're overthinking this. There is no masterplan and no pushback. Just some issues with the old standard -- v8 has even implemented the feature in initial form (but not enabled):
https://v8project.blogspot.gr/2016/04/es6-es7-and-beyond.html https://v8project.blogspot.gr/2016/04/es6-es7-and-beyond.htm...
- jnbiche 9y ago> There is no masterplan and no pushback. I don't think there's a masterplan or some anti-functional conspiracy, but I do think there's pushback. They implemented the feature behind a flag but from what I've read (can't find the reference now), they are not planning to ever release it.
- coldtea 9y agoProbably looking for this then: https://github.com/tc39/proposal-ptc-syntax/issues/22 https://github.com/tc39/proposal-ptc-syntax/issues/22 But their pushback is for pragmatic reasons, not because they don't like recursion/tail calls.
- jnbiche 9y ago> But their pushback is for pragmatic reasons I saw zero reasons given for the failure to implement in that thread (which I had not seen before), other than a brief mention of stack traces (which is quite solvable with a shadow stack). All I saw were several people (including someone involved with the spec) who were bitterly disappointed about the failure to implement. And I forgot that tail call elimination was introduced back in ES5, and yet only JavaScriptCore has implemented it. Which again leads me to believe that most implementers believe it's just not worth the trouble to them to implement a key feature for functional programming, regardless of how much the users want it (the feedback in this thread is similar to what i've seen elsewhere).
- apaprocki 9y agoYou can read the minutes here https://github.com/tc39/tc39-notes/blob/master/es7/2016-05/may-24.md#syntactic-tail-calls-bt https://github.com/tc39/tc39-notes/blob/master/es7/2016-05/m...
- mercer 9y agoCould you elaborate? Based on my experience with functional(-style) programming in Clojure and Elixir, tail calls are important enough that, worst case scenario, they might even warrant their own syntax addition (like with Clojure's recur?). I might be way out of my depth here though; I couldn't quite grok the discussion in your link. Is there's a way perhaps you could 'ELI5' why it's pragmatic to ignore this issue?
- coldtea 9y agoIt's pragmatic because adding proper tail calls in the JS engines is difficult and raises several issues (lost stack frames, memory guarantees, etc.) but we were able to survive 20+ years without having them in JS, so it's not like they are essential.
- jnbiche 9y ago> we were able to survive 20+ years without having them in JS, so it's not like they are essential. And voila the attitude I was referring to, it comes out. Recursion is pretty damn essential to functional programming, and like it or not that's the way JS is headed.