Comment by haberman
6 months ago
I blogged about this: https://blog.reverberate.org/2025/02/10/tail-call-updates.ht...
It uses a technique I published several years ago for writing fast interpreters with tail calls: https://blog.reverberate.org/2021/04/21/musttail-efficient-i...
There is also this tweet from the author: https://x.com/kenjin4096/status/1887935698906529903
While it's not implemented, Rust even has a keyword reserved [1] for musttail, "become": https://github.com/phi-go/rfcs/blob/guaranteed-tco/text/0000...
[1] https://doc.rust-lang.org/reference/keywords.html
And like everything else in Rust, it will forever live in the "unstable" pile of features that are required to use the language without standing on your head (looking at you, pattern matching through boxes).
For us non-compiler nerds, can you comment on which compilers support musttail? I suppose latest clang has it. gcc: since you mentioned support was only added in July 2024, I suppose it's not in gcc 14 yet? How about Apple clang from Xcode 16? And MSVC?
I don't closely follow the release schedules for Clang, GCC, etc, so I don't have up-to-date info on that. Unfortunately I'm not aware of any support for musttail in MSVC.
Thanks for the article.
Funnily enough, the first half of the article made a lot more sense after the second half where i was wondering "wouldn't goto do the same?" And then i remembered it was mentioned in the first half...