Is the tailcall crate truly zero cost as advertised?

The problem is making sure that Rust offers it on all the targets -- or at least all the "important enough" targets, but there's no agreement on which are unimportant either.

For example, WASM didn't have tail calls until recently, and nobody wanted a "don't use become because it doesn't work on WASM" folklore to take hold.

If Rust only needed to work on x64 linux, it would have guaranteed tail calls already. But we don't want things that only work sometimes.

(Tail recursion in the same function would be relatively simple to add, but also much less interesting -- it can be done with a simple combinator, for example: When will Rust have TCO/TCE? - #3 by scottmcm )

2 Likes