3 ms·
Do any widely used languages guarantee tail call optimization? It's a pretty niche feature.
by IshKebab 27d ago
Do any widely used languages guarantee tail call optimization? It's a pretty niche feature.
- gpm 27d agoScala, ocaml, racket, clojure, zig. For recursion only kotlin. (For most of these only with syntax specifying it)
- lioeters 26d agoHow interesting. I'd seen LISP(y) implementations like Scheme guarantee tail-call since recursion is a very common technique in that language family. But I didn't know Zig supported it. https://ziglang.org/documentation/master/#call https://ziglang.org/documentation/master/#call They have an @call built-in that guarantees: always/never tail, as well as always/never inline. That's neat, I can see how that would be useful in various situations.
- chuckadams 25d agoJavaScript too, but only implemented in JavaScriptCore, so basically just Safari and Bun.
- deleted 26d ago[deleted]
- pjmlp 26d agoDepends on how widely we consider Scheme and Raket adoption in CS curriculum.