News for hackers. Stuff that matters.
Re:Rust will likely not support tail call optimization by protomyth on Wednesday April 10, 2013 @02:42PM (#5527137)
It seems like part of decision was reached because of limitations in LLVM[1]. This makes me a bit uneasy, but I guess it has to follow C to meet its goals.

1) "LLVM does support tail call optimization, but it requires using a different calling convention than C and slowing down all function calls" from https://mail.mozilla.org/pipermail/rust-dev/2013-April/00355... and http://llvm.org/docs/CodeGenerator.html#tail-call-optimizati...

Re:Rust will likely not support tail call optimization by cwzwarich on Wednesday April 10, 2013 @04:56PM (#5528104)
They could also add their own calling convention to LLVM to support what they want like GHC and HiPE have done.
Re:Rust will likely not support tail call optimization by saidajigumi on Wednesday April 10, 2013 @09:03PM (#5529266)
No they can't, at least not without compromising on several points laid out in TFA. Mainly these two:

    - Tail calls also "play badly" with assumptions in C 
      tools, including platform ABIs and dynamic linking.

    - Tail calls require a calling convention that is a 
      performance hit relative to the C convention.
See other posts in this discussion for examples of the impacts of some alternate calling convention choices.
Re:Rust will likely not support tail call optimization by anonymous on Thursday April 11, 2013 @02:21AM (#5530279)
Then how can GCC and clang do TCE in C programs?
Re:Rust will likely not support tail call optimization by aidenn0 on Thursday April 11, 2013 @03:24AM (#5530452)
1) They can't do it all the time

2) Some of the times they can do it, they do it when they control both the caller and the callee. In that case you can violate the ABI to your heart's content.

3) I don't really see TCE as an issue in Rust, since they seem to be going the RAII route and, as others have commented, RAII and TCE don't play well together (for the same reason a call at the end of a dynamic binding can't be TCE'd in common-lisp).