DIP: Tail call optimization

Ola Fosheim Grøstad via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Jul 10 10:16:10 PDT 2016


On Sunday, 10 July 2016 at 17:10:32 UTC, Dietrich Daroch wrote:
> Annotating every callsite seems uncomfortable, being able to 
> perform TCO is a property of the function and not something 
> that might look call-site dependant.

You only need to annotate the location where the function calls 
itself. The function might want some recursive calls to work 
without tail recursion restrictions and at the same time use tail 
recursion at the end.

Or do you mean that this should prevent all kinds of recursion? 
That is a quite demanding analysis. For instance, the function 
could get itself passed in as a parameter...



More information about the Digitalmars-d-announce mailing list