On Apr 2, 2009, at 1:14 PM, Jim Menard wrote:
> > On Thu, Apr 2, 2009 at 1:10 PM, Bradford Cross > <bradford.n.cr...@gmail.com> wrote: >> What is the current state of the art for language implementers >> working >> around these issues (tail calls, continuations, etc) in Clojure, >> Scala, >> JRuby, etc? > > Clojure uses recur (http://clojure.org/special_forms#toc10), "the only > non-stack-consuming looping construct in Clojure". In practice, recur in clojure is all you ever need to write non-stack- consuming functions that have excellent performance characteristics (each recursion is simply a trip through a while loop, IIRC). I actually like the explicitness of recur, simply because of how it makes what's going on completely obvious. Of course, that's fundamentally an issue of style and idiom, and doesn't make the lack of real TCO any less of a priority. In those rare circumstances where you need to write mutually-recursive functions without consuming stack, clojure provides a trampoline implementation (introduced last November here: http://groups.google.com/group/clojure/browse_frm/thread/6257cbc4454bcb85) . There's obviously a performance penalty associated with their use, but it's nice to have that escape hatch. - Chas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to jvm-languages@googlegroups.com To unsubscribe from this group, send email to jvm-languages+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---