On Mon, Feb 8, 2010 at 8:16 PM, John Meacham <john@repetae.net> wrote:

> I expect others have forethought and perhaps even experimented with such
> a language. Are there any dangers to be wary of that undo the entire
> endeavour?

There have been a couple papers published on it, the main sticking point
seems to be tail call elimination. When targeting real hardware you
always had the option of dropping to assembly to do a direct jump, but
there isn't an equivalent in the JVM. If you look up tail call + jvm you
will probably get a few hits. I believe there are even a couple haskell
specific papers on the issue.

One of the easiest approaches to this comes from the scheme folks and I've been able to employ it fairly effectively in toy compilers. It doesn't require anything from the host language except exceptions and you can use it to evaluate spineless tagless g-machine frames mostly on the native/VM stack fairly easily. The biggest problem is the generated code bloat factor of about 2-3x.

http://www.ccs.neu.edu/scheme/pubs/stackhack4.html
http://www.cs.brown.edu/~sk/Publications/Papers/Published/pcmkf-cont-from-gen-stack-insp/

-Edward Kmett