Mutual optimization of tail recursion does not work in D

w0rp via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 31 04:57:49 PDT 2015


Mutual tail call optimisation doesn't work in C++ either.

Because it's not a language feature in C++ or D. It is not 
required by the standards of either language. It's an 
optimisation which compilers apply. I am guessing you are using 
DMD, which might not offer the best optimisations for runtime 
code, but has other benefits.

You might want to try GDC or LDC. I am not certain if they 
implement tail call optimisations, but they might do, and it 
seems like a good optimisation to have. I'm sure this has been 
discussed before.


More information about the Digitalmars-d-learn mailing list