3 ms·
Originally, though, it didn't. See the current language in the link you provided, emphasis added: Kawa now does general tail-call elimination, but only if you
by hga 11y ago
Originally, though, it didn't. See the current language in the link you provided, emphasis added:
Kawa now does general tail-call elimination, but only if you use the flag --full-tail-calls. (Currently, the eval function itself is not fully tail-recursive, in violation of R5RS.) The --full-tail-calls flag is not on by default, partly because it is noticably slower (though I have not measured how much), and partly I think it is more useful for Kawa to be compilatible with standard Java calling conventions and tools. Code compiled with --full-tail-calls can call code compiled without it and vice versa.
- SeanLuke 11y agoThe fact that it didn't originally is irrelevant. And the fact that you have to provide a flag because of performance is irrelevant. It still remains that Kawa appears to do full tail call optimization on the JVM. So it can't be that Clojure doesn't do it because the JVM doesn't permit it. So what's really going on here?
- reitzensteinm 11y agoPerformance isn't irrelevant to the question of "what's really going on here". If it costs too much at run time, Clojure absolutely should not implement it. Lack of TCO isn't that big of a deal.
- kuschku 11y agoKawa emulates it by adding overhead that interprets and replaces code with loops. Clojure is instead waiting for a solution on JVM-level.