It would be nice if Scala had a scheme-like do
or named-let. This would allow the programmer to force (and declare) some recursive calls to be compiled as efficiently as tail calls, but without requiring all to be.
The Clojure language has such a construct called loop
, but doesn’t have normal tail calls. The Clojure construct allows the compiler to verify that the loop is tail-call-optimizable. It would be nice to have both.