News for hackers. Stuff that matters.
Re:Rust will likely not support tail call optimization by pcwalton on Wednesday April 10, 2013 @09:33PM (#5529374)
The most applicable idiom for Rust is to use looping with higher-order functions. Rust code doesn't really favor recursion.
Re:Rust will likely not support tail call optimization by jacquesm on Thursday April 11, 2013 @12:57AM (#5530059)
Yes, but that may very well be because it does not do TCO... What's idiomatic in a language is usually the result of how efficiently that language implements certain constructs.
Re:Rust will likely not support tail call optimization by pcwalton on Thursday April 11, 2013 @01:17AM (#5530112)
Even if we implemented TCO, I doubt it would be idiomatic because destructors reduce the number of tail call positions so dramatically.
Re:Rust will likely not support tail call optimization by jacquesm on Thursday April 11, 2013 @01:31AM (#5530139)
Right, because any destructor would break your ability to do TCO assuming that it runs before the tail call... So as soon as you use an object mechanism that will invoke a destructor at some point your ability to use TCO is gone.

Interesting, isn't there a possible transformation where you would be able to move the constructor/destructor pairs out of the generated loop construct without breaking the function?

After all a tail call is just a fancy go-to under the hood.