Given that the JVM does is not able support these essential Scheme
features, and that this will probably not change soon (if ever, let
alone for non-openjdk based VMs such as Dalvik), such an approach might
well be appropiate for implementation within Kawa. However, it seems as
if this change would have a rather big performance impact, so maybe it
would be a better idea to make this behavior optional for those
applications where full continuation and tail call support is not
required.
Is there a possibility that something like this could be implemented in
Kawa? Is there maybe someone actually working on it? If not, I could
help to implement this, though I don't know anything about the Kawa code
base currently.
There is nobody currently working on it, though it's long been on the
wish-list.
In fact there is some long-dead experimental unfinished code in the
code-base
- search for usingCPStyle in gnu/expr/*.java.
There was a Goggle Summer of Code proposal for full continuations, but
unfortunately we didn't get enough "slots":
http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/tartanllama/1
In addition to reading the proposal, I suggest studying:
http://www.ccs.neu.edu/scheme/pubs/stackhack4.html
Even if you don't follow the approach in that link, it point out the kind
of re-writing that would be needed. Basically, it seems feasible to get
full
continuations without too much pain by doing certain transformations
on the
abstract syntax tree (awa's Expression nodes), and then just compiling
with
full-tailcalls support enabled.