3 ms·
Note that a lot has changed since April of 2013. Rust does have TCO, we just can't guarantee it. And, LLVM has come a long way, so we probably can support guara
by steveklabnik 11y ago
Note that a lot has changed since April of 2013. Rust does have TCO, we just can't guarantee it. And, LLVM has come a long way, so we probably can support guaranteed TCO now, and have 'become' as a reserved keyword for this purpose.
https://github.com/rust-lang/rfcs/issues/271 https://github.com/rust-lang/rfcs/issues/271 is a better link today.
- riquito 11y agoThat's really a good news! Thank you for pointing that out.
- hamstergene 11y agoI praise the idea of making TCO explicit and guaranteed, but wonder if whole new keyword is necessary? It could be avoided by modifying `return` with another keyword which is currently impossible at that place, for example return as foobar(x, n-1) return in foobar(x, n-1) override return foobar(x, n-1) final return foobar(x, n-1) It's a little surprising to see entirely new construct invented for something that is just a different implementation of `return`, after all, the end result of computation with tail-return is the same as with normal return, only performance differs.
- steveklabnik 11y agoIn theory, we could have done that too, and I guess we still could.