This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Full continuations with heap-based program stack?
On 09/12/2011 12:24 AM, Denis Washington wrote:
By the way, I think the documentation on the Kawa homepage still says
that full tail calls are not supported.
I don't where this is the case. The actual "home page" doesn't
mention tail-calls at all:
http://www.gnu.org/software/kawa/index.html
In addition to reading the proposal, I suggest studying:
http://www.ccs.neu.edu/scheme/pubs/stackhack4.html
I went through both the proposal and the paper. Like I understood it,
the approach presented in the paper is like normal full CPS except for
the fact that continuation closures are only created on-demand via
throwing an exception, instead of implicitly on each application, is
that correct?
Well, it's not full CPS, but A-Normal Form - which is functionally
equivalent.
See http://citeseer.ist.psu.edu/flanagan-essence.html
And it's not clear this is the easiest way to implement continuations.
Doing CPS conversion, creating lots of little functions, and then
compiling with full-tailcalls enabled may be easier and good enough,
at least as a start. Then we can revisit/optimize based on the results
of the Java lambda implementation experience (slated for Java 8 next year).
As such an implementation does not decrease the speed of code not using
continuations much (if at all), I guess that this way of implementing
continuations in Kawa is more desirable than a traditional full CPS
transformation. (Many programs can do without first-class continuations,
after all.) Do you think the same?
It seems like an interesting approach, though it may lead to a bit of
code bloat. And notice the caveats in the "Future Work" section.
I have not tried to read the paper in detail enough to claim I grok it.
--
--Per Bothner
per@bothner.com http://per.bothner.com/