News for hackers. Stuff that matters.
Re:Rust will likely not support tail call optimization by andolanra on Wednesday April 10, 2013 @08:22PM (#5529122)
There are better alternatives to said debugging switch for examining the stack of tail-call-optimized programs, c.f. Clements and Felleisen's 2004 paper, "A Tail-Recursive Machine with Stack Inspection." The debugging switch is merely the simplest naïve option.

Essentially, your engineering tradeoff boils down to, "It's easier (for implementers) to omit TCO." That is actually a very reasonable and rational position, as simpler implementations are less likely to have bugs and have a lower creation cost. However, I still hold that the advantages of TCO outweigh the concern about its implementation. (Also, I do not believe that Python does place conservative requirements on an implementation's stack, as a conformant Python implementation must also implement generators; I regard this as roughly on par with TCO's complexity.)

Re:Rust will likely not support tail call optimization by kragen on Wednesday April 10, 2013 @08:46PM (#5529195)
Complexity and stack space usage are two very different things. CPython does indeed place (very!) conservative limits on stack depth, and it also implements generators. I haven't looked at the generator implementation, but it has a number of limits that make it easy to implement — the main one is that generators don't have their own stacks, so can't yield from inside a function they call, the way e.g. Lua coroutines or (effectively) Icon generators can.
Re:Rust will likely not support tail call optimization by andolanra on Wednesday April 10, 2013 @09:16PM (#5529323)
I'm sorry, I made something of a terminological error. When I said 'complexity', I was referring to complexity of implementation, not algorithmic time or space complexity. My intention was to assert that implementing generators and implementing tail-call optimization are both endeavors of roughly the same order of engineering difficulty (as the mechanism used to implement TCO is quite simple) and not to compare the stack space required by each.

I also should clarify that at this point, it's likely not reasonable to expect Guido or the Python community to ever turn around and decide to implement TCO, as the current engineering effort required to add TCO to all active implementations of Python is much larger in comparison to the engineering required to add it at an earlier stage. I regard this as a failure of the langauge design from the start, but having made their decision I don't fault the Python community for sticking to it.

Re:Rust will likely not support tail call optimization by kragen on Wednesday April 10, 2013 @11:51PM (#5529885)
I was responding to your "I do not believe that Python does place conservative requirements on an implementation's stack", in response to bcoates's statement that it does, nothing about complexity. I was just trying to clarify (my interpretation of) what he said.
Re:Rust will likely not support tail call optimization by jacobolus on Thursday April 11, 2013 @04:02AM (#5530598)
Actually, in Python 3.3 they can (sort of). See PEP 380: http://www.python.org/dev/peps/pep-0380/
Re:Rust will likely not support tail call optimization by kragen on Thursday April 11, 2013 @12:40PM (#5533056)
Thanks! I didn't know this, and it should remove a log-N factor from a lot of algorithms :)
Re:Rust will likely not support tail call optimization by bcoates on Wednesday April 10, 2013 @09:40PM (#5529402)
I believe that both C# iterator-functions and python generators are designed with enough limits that they can be implemented as syntax sugar: you lift the generator function's locals into an object and decompose the function body into a state-machine.