DEV Community


Discussion on: The Story of Tail Call Optimizations in Rust

seanchen1991 profile image
Sean Chen Author

That's a good point that you raise: is TCO actually important to support in Rust?

I think to answer that question, we'd need data on the performance of recursive Rust code, and perhaps also how often Rust code is written recursively.

In my mind, Rust does emphasize functional patterns quite a bit, especially with the prevalence of the iterator pattern. Despite that, I don't feel like Rust emphasizes recursion all that much, no more than Python does from my experience.

So perhaps there's an argument to be made that introducing TCO into rustc just isn't worth the work/complexity.