Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Gregory Ewing Newsgroups: comp.lang.python Subject: Re: Possibly Pythonic Tail Call Optimization (TCO/TRE) Date: Wed, 15 Jul 2015 21:13:00 +1200 Lines: 19 Message-ID: References: <55A3A853.4040006@rece.vub.ac.be> <55A3C366.6060602@rece.vub.ac.be> <87fv4r1fre.fsf@jester.gateway.sonic.net> <87bnff1eks.fsf@jester.gateway.sonic.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 4OQqyGGmStR1Lj28DqKY5QqC5ak9tJoTzEl4qVwegertAMeFf4 Cancel-Lock: sha1:N7j69qyB4wvl9UeAPBJ5NO3BIHU= User-Agent: Mozilla Thunderbird 1.0.5 (Macintosh/20050711) X-Accept-Language: en-us, en In-Reply-To: Xref: csiph.com comp.lang.python:93856 Chris Angelico wrote: > I'm still interested in the explicit "replace current stack frame with > this call" operation. Calling it "goto" seems wrong, as most languages > with goto restrict it to _within_ a function, This just suggests to me is that most language designers are not very imaginative. :-) A tail call *is* a goto. That's how you implement one in assembly language -- you write a jump instruction instead of a call instruction. The jump doesn't have to be to the same function. Also see: https://litrev.wordpress.com/2009/07/16/lambda-the-ultimate-goto/ -- Greg