5 ms·
.NET has tail call optimization. Does clojure clr implement support for it?
by jared314 17y ago
.NET has tail call optimization. Does clojure clr implement support for it?
- noblethrasher 17y agoI can't be bothered to download and run reflector on it but if they made it completely in C# then I don't see how they could have taken advantage of TCO since the compiler doesn't ever make use that CLR instruction.
- jared314 17y agoI think you are confusing the clojure compiler and the clojure language compiler.
- DrJokepu 17y agoAs far as I can see Clojure CLR uses the Dynamic Language Runtime and Expression Trees which do support tail recursion. I don't know if Clojure CLR takes advantage of it, probably not. However, recent .NET VMs automatically apply tail-recursion optimization if a number of specific conditions are met, even if the compiler doesn't actually emit tail-recursive IL.
- snprbob86 17y agoPresumably the Clojure compiler emits MSIL. You can emit whatever instructions you want, even if the host language's compiler doesn't emit those instructions.