proper tail calls
igor at mir2.org
Wed Jan 23 07:22:28 PST 2008
On 23/01/2008, Lars Hansen <lhansen at adobe.com> wrote:
> Ditto, interprocedural analysis and/or inlining
> may prove that the body of a "try" can't throw an exception, thereby
> allowing the exception handler to be removed, thereby exposing a
> possibility for TCO. And so on.
This nicely shows the weakness of the explicit TCO enforced at the
compile time. It is not future proof. If an implementation can turn
return 2 * f(args)
into a tail call, a programmer would not be able to write
tail return 2 * f(args).
since this is not a valid syntax. So the programmer who needs this
fine control over space complexity would not be able to state that.
More information about the Es4-discuss