I wish that Rust would follow the lead of some languages in allowing one to explicitly mark a function as recursive. (Not exactly the same as TCO, I understand, but related)
I understand the argument against doing TCO in a low level language like Rust (debugging stack traces, etc). But as an opt-in? Yes, please!
OCaml, which is like Rust's muse/parent, does it. Kotlin and Clojure do that as well, IIRC.
What do you mean by 'exactly as useful'? I can see how they are both useful, and there are even some problems were either approach works. But I don't see an exact correspondence?
The function that performs the tail-call won't show up in stack traces. This is intentional (and needed) when it's done to eliminate an infinite number of recursive calls, but if it's just a utility function then it can be confusing.
As an ObjC example, there's an objc_msgSend call between every two methods in a stack trace, but you never see it.
I understand the argument against doing TCO in a low level language like Rust (debugging stack traces, etc). But as an opt-in? Yes, please!
OCaml, which is like Rust's muse/parent, does it. Kotlin and Clojure do that as well, IIRC.