Hacker News new | ask | show | jobs
by adamddev1 1655 days ago
Or how about TCO (tail-call optimization)? Please pretty please!
2 comments

TCO is something that specific JS engines need to implement. It is implemented in JSC (Safari), but not in V8 or SpiderMonkey. Also see https://v8.dev/blog/modern-javascript#proper-tail-calls.

As this is an engine feature rather than a spec thing, there is nothing me (or any other TC39 delegate) can do.

Oh yes, I see, that's true. Thanks for the explanation.
Proper tail calls are ALREADY part of the spec.

Google and Mozilla simply chose to ignore the spec.

More like Google, Mozilla just waits to see if Google is going to implement it since they can't think for themselves.
It would be so nice to have it though! It could do a lot popularize recursive problem-solving and function writing, without having to go into modifying these functions to make them stack-safe.