| ▲ | embedding-shape 3 hours ago | |||||||
> 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. | ||||||||
| ▲ | koverstreet 3 hours ago | parent [-] | |||||||
I haven't been following become/TCO in Rust - but what I've usually seen is TCO getting flipped off because it interferes with backtraces and debugging. So I think there's value in providing it as an explicit opt-in; that way when you're reading the code, you know to account for it when you're looking at backtraces. Additionally, if you're relying on TCO it might be a major bug if the compiler isn't able to apply it - and optimizations that aren't applied are normally invisible. This might mean you could get an error if you're expecting TCO and you or the compiler screwed something up. | ||||||||
| ||||||||