Live data from Hacker News

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

mgmarlow.com

1–10 of 146 posts

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

#2
Reads like a sad state of affairs, but the article itself doesn't really explain whatbthe actual concerns where that caused the proposals to be put on ice.

From reading, I mostly get "PTC was un-implemented and put on ice because some browser vendors had issues with it; the alternative proposal, STC, was put on ice because other browser vendors had different issues with it. Then everyone (from the browser vendor side) kind of lost interest."

But what were the actual issues that blocked the two proposals?

Edit: Ah, I'm sorry. The issues with PTC are indeed described, but STC was brought forward specifically to address those reasons. So why wasn't STC implemented then?

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

#3
One advantage of syntactic tail calls is that you can give an error if you are unable to transform to a tail call.

Otherwise, you could have a program that seems to work file, and then you refactor and now your recursion isn’t a tail call anymore, and your stack blows up.

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

#5
post #2

Reads like a sad state of affairs, but the article itself doesn't really explain whatbthe actual concerns where that caused the proposals to be put on ice. From reading, I mostly get "PTC was un-implemented and put on ice because some browser vendors had issues with it; the alternative proposal, STC, was put on ice because other browser vendors had different issues with it. Then everyone (from the browser vendor side…

It's in the article?

1. more difficult to understand during debugging

2. less information about execution flow which may break telemetry

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

#6
post #2

Reads like a sad state of affairs, but the article itself doesn't really explain whatbthe actual concerns where that caused the proposals to be put on ice. From reading, I mostly get "PTC was un-implemented and put on ice because some browser vendors had issues with it; the alternative proposal, STC, was put on ice because other browser vendors had different issues with it. Then everyone (from the browser vendor side…

[From the article]

Why are browser vendors ignoring PTC? V8 chalks it up to two main reasons:

* It makes it more difficult to understand during debugging how execution arrived at a certain point since the stack contains discontinuities, and

* error.stack contains less information about execution flow which may break telemetry software that collects and analyzes client-side errors.

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

#9
post #8

Worth reading why python doesn’t have it either http://neopythonic.blogspot.com/2009/04/tail-recursion-elimi...

> Python's default is and should always be to be maximally helpful for debugging.

I can’t say I understand the whole topic but when someone who knows more than me says that…. It is a pretty compelling argument to me.

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

#10
post #9
post #8

Worth reading why python doesn’t have it either http://neopythonic.blogspot.com/2009/04/tail-recursion-elimi...

> Python's default is and should always be to be maximally helpful for debugging. I can’t say I understand the whole topic but when someone who knows more than me says that…. It is a pretty compelling argument to me.

It's kind of a weird argument though. How do you expect a for loop to be represented in a stack trace?
Post reply on HN