| ▲ | IshKebab 5 hours ago | ||||||||||||||||
I vaguely recall that there's a Rust macro to automatically convert recursive functions to iterative. But I would just increase the stack size limit if it ever becomes a problem. As far as I know the only reason it is so small is because of address space exhaustion which only affects 32-bit systems. | |||||||||||||||||
| ▲ | jeroenhd 5 hours ago | parent | next [-] | ||||||||||||||||
Explicit tail call optimization is in the works but I don't think it's available in stable jut yet. The `become` keyword has already been reserved and work continues to happen (https://github.com/rust-lang/rust/issues/112788). If you enable #![feature(explicit_tail_calls)] you can already use the feature in the nightly compiler: https://play.rust-lang.org/?version=nightly&mode=debug&editi... (Note that enabling release mode on that link will have the compiler pre-calculate the result so you need to put it to debug mode if you want to see the assembly this generates) | |||||||||||||||||
| ▲ | embedding-shape 5 hours ago | parent | prev [-] | ||||||||||||||||
> I vaguely recall that there's a Rust macro to automatically convert recursive functions to iterative. Isn't that just TCO or similar? Usually a part of the compiler/core of the language itself, AFAIK. | |||||||||||||||||
| |||||||||||||||||