News for hackers. Stuff that matters.
Re:Rust will likely not support tail call optimization by masklinn on Wednesday April 10, 2013 @03:25PM (#5527462)
Wouldn't it be possible to have some sort of macro able to "manually" convert calls in a recursive style into loops? Something along the lines of Clojure's `loop/recur` but less tricky (and maybe with a single "word")?
Re:Rust will likely not support tail call optimization by ufo on Wednesday April 10, 2013 @05:30PM (#5528332)
Self recursion is only a particular case and you can often represent it with loops or folding patterns as you are imagining. However, the really cool use for tail call elimination is when you are calling other functions since you can't rewrite the code without breaking encapsulation. Out of the top of my head, one important example of this would be continuation passing style (you need TCO to turn the continuations into real "gotos")
Re:Rust will likely not support tail call optimization by gngeal on Wednesday April 10, 2013 @07:13PM (#5528838)
That would be useless. I believe the point of proper tail calls is that the set of functions that may be called from a particular call site is not closed. The callee may be a parameter of the caller, for example in combinator-style libraries. You can't convert that in advance.
Re:Rust will likely not support tail call optimization by pcwalton on Wednesday April 10, 2013 @04:11PM (#5527804)
Yes, I think so.