https://crates.io/crates/tiny_tco
As an optimization my understanding is that GCC and LLVM implement it so Rust, C, and C++ also have it implicitly as optimizations that may or may not apply to your code.
But yes, zig does have a formal language syntax for guaranteeing tail calls to happen at the language level (which I agree with as the right way to expose this optimization).
I did not know that! But I am a bit confused, since I don't really program in either language. Where exactly in the documentation could I read more about this? Or see more examples?
The language reference for @call[0] was quite unhelpful for my untrained eye.
[1]: https://github.com/ziglang/zig/issues/694#issuecomment-15674... [2]: https://github.com/llvm/llvm-project/issues/54964 [3]: https://github.com/rust-lang/rfcs/pull/3407
> All current mainstream compilers perform tail call optimisation fairly well (and have done for more than a decade)
https://stackoverflow.com/questions/34125/which-if-any-c-com... (2008)
You can now get a guarantee by using non-standard compiler attributes:
https://clang.llvm.org/docs/AttributeReference.html#musttail
https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html...
https://ocaml.github.io/ocamlunix/ocamlunix.html
MirageOS
House OS,
https://programatica.cs.pdx.edu/House/
Just saying.