Extent of tail call optimization in D?

J. Jenkins jenkinsj89 at yahoo.ca
Tue Nov 13 12:34:32 PST 2012


In Dr Alexandrescu's "The D Programming Language", on page 12, it 
is noted that the D compiler will rewrite tail calls within a 
procedure as loops.  Does the compiler rewrite tail calls between 
procedures as jumps?

For example, in pseudo-D:

void foo(K)(K cont, stuff..) {
     // Do things with stuff.
     cont(things);
}

Is the call `cont(things)' optimized?



More information about the Digitalmars-d-learn mailing list