On Thursday 02 April 2009 18:10:05 Bradford Cross 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?

The state of the art in all of the major "functional" languages for the JVM 
(Scala and Clojure) is that they die with a stack overflow because the JVM 
lacks tail calls. :-)

> I would imagine people are maintaining their own stacks?  stacks and hacks.

Martin Odersky, the creator of Scala, put a lot of effort into finding 
workarounds for the lack of tail calls on the JVM:

  http://docs.msdnaa.net/ark_new/Webfiles/WhitePapers/Babel01/bab12.pdf

but, in the end, he gave up completely and Scala provides no workaround.

Clojure also provides no workaround.

The creators of both languages are pinning their hopes on getting tail calls 
in the VM and settling for local hand-written trampolines in the mean time.

> We have talked about the fact that certain programs are invalid without TCO
> because they will overflow the stack - true enough.
>
> Does anyone have any crude benchmarks re the perf overhead of doing these
> things in hand rolled stacks vs. at the byte code level.  I have to imagine
> it is massive for certian classes of programs.

I am not aware of a performance comparison between a workaround (such as a 
global trampoline) and tail calls in the VM. There are comparisons with 
non-tail calls in inefficient language implementations that range from 
1.2-10x slower but that is of no relevance.

Benchmarking against MLVM with tail calls would be interesting...

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to