What happened to proper tail calls in JavaScript? (2021)

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • proposal-ptc-syntax

    Discussion and specification for an explicit syntactic opt-in for Tail Calls.

  • The spec for STC has a critique of PTC:

    - performance

    - developer tools

    - Error.stack

    - cross-realm tail calls

    - developer intent

    See: https://github.com/tc39/proposal-ptc-syntax#issues-with-ptc

    Apple's 2016 response as to why they won't implement STC is here: https://github.com/tc39/ecma262/issues/535

    - STC is part of the spec and will take too long to change.

    - Now that they've implemented support for PTC, they don't want to regress web pages that rely on it.

    - They don't want to discourage vendors from implementing PTC by agreeing to STC.

    - They don't want to introduce confusion.

    Some of these arguments about confusion and delays seem wrong hindsight, since on every point things would have been better if they'd just agreed to the compromise of STC.

    - It would have been part of the spec years ago

    - STC would have had a clear way for web pages to know when tail calls could be relied on (and PTC would have been optional)

    - Other vendors didn't implement PTC in any case, despite no agreement on STC

    - There's even more confusion as things are now

  • Elixir

    Elixir is a dynamic, functional language for building scalable and maintainable applications

  • The problem that’s hard to get around is this:

    https://github.com/elixir-lang/elixir/issues/6357

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • rr

    Record and Replay Framework

  • For execution, a stack is a continuation. For debugging, we pretend like it's a historical record, and mostly get away with it. Various things break the correspondence slightly. TCO breaks it a lot more.

    Debugging is important. It doesn't get enough respect. Stacks are a pretty critical component of debugging, for better or worse.

    It would be great if we didn't depend on this fiction quite so much. With native code, there are definitely alternative options now, such as rr[1] and Pernosco[2] where if you want to look back in time—well, you just go back in time. For JavaScript, that's becoming more and more possible with things like Replay[3]. Perhaps before long, the debugging argument will just go away.

    [1] https://rr-project.org/

    [2] https://pernos.co/

    [3] https://www.replay.io/

  • ecma262

    Status, process, and documents for ECMA-262

  • The spec for STC has a critique of PTC:

    - performance

    - developer tools

    - Error.stack

    - cross-realm tail calls

    - developer intent

    See: https://github.com/tc39/proposal-ptc-syntax#issues-with-ptc

    Apple's 2016 response as to why they won't implement STC is here: https://github.com/tc39/ecma262/issues/535

    - STC is part of the spec and will take too long to change.

    - Now that they've implemented support for PTC, they don't want to regress web pages that rely on it.

    - They don't want to discourage vendors from implementing PTC by agreeing to STC.

    - They don't want to introduce confusion.

    Some of these arguments about confusion and delays seem wrong hindsight, since on every point things would have been better if they'd just agreed to the compromise of STC.

    - It would have been part of the spec years ago

    - STC would have had a clear way for web pages to know when tail calls could be relied on (and PTC would have been optional)

    - Other vendors didn't implement PTC in any case, despite no agreement on STC

    - There's even more confusion as things are now

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts