Hacker News new | comments | ask | show | jobs | submit login

Why doesn't tail call optimization get any love?

Unfortunately it get's lots of pushback instead. It seems very likely that syntax will get changed to `return continue fn()` https://github.com/tc39/proposal-ptc-syntax

Somewhat related there is no optimization for passing arbitrary length arrays with `...` to function having `...rest` as the last argument, which means [].splice is still a footgun:(

That explicit tail recursion syntax is pretty gross. Is there a precedent in any other language?

Rust has plans for a `become` operator for tail call optimization.

Clojure's recur is kinda-close, I guess?

It is, but Clojure uses it, because it cannot really do Tail Call Optimization due to constraints on the JVM. Therefore "recur" is required to keep the Stack from overflowing.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact