Chasing tail

Created 9th July, 2007 17:22 (UTC), last edited 9th July, 2007 17:31 (UTC)

ndanger.organism points out I explain a minor point about the Scheme language specification to Chris Diggins:

Kirit’s comment points out that the Scheme code is necessary to make the function tail recursive.

I don't know Scheme, but I do know the tail recursive requirements in the language specification because I researched them for Recursive rights and wrongs.

The question that I have though is, “Just how far do you have to go to convince the compiler that it's tail recursive?”

When I originally wrote Recursive rights and wrongs I said that the forms that I was using where tail recursive. Any inspection of the code could tell that they weren't tail recursive, at least not canonically so. But the transformation seemed so trivial to me that I described it that way anyway.

So this begs the question, “How smart are compilers these days?”

What scares me about the possible answers is the amount of code that I have written where I think the optimising transformations are obvious… Is all my code belong to slow?