A tail-call interpreter in (nightly) Rust

45 points by tekknolagi


amit

become is an interesting specific instantiation of something I'd love to see more of (hard compiler guarantees).

Specifically, it would be great to have the ability to say more general statements of the form "if this doesn't end up optimized how I expect it to be, emit a compile error" to prevent random performance degradation when something e.g. monomorphizes very weirdly.

doug-moen

I hope that proper tail calls move from nightly Rust into stable.

However, I note that "Explicit Tail Calls" has been under development since 2023, and the RFC has not been accepted yet.

https://doc.rust-lang.org/nightly/std/keyword.become.html
https://github.com/rust-lang/rust/issues/112788
https://github.com/rust-lang/rfcs/pull/3407

The lack of proper tail calls is one of the show-stoppers preventing me from writing the next version of my VM in Rust. I am currently using C++.