First-class continuations in Kawa

Andrea Bernardini andrebask@gmail.com
Sun Aug 8 15:53:59 GMT 2021


Hi Arvydas,
As far as I remember we never took into account interaction of call/cc
outside of scheme code. The top level handler is added to the top level
ModuleExp when the scheme code is compiled. When you define a class I don't
think it's wrapped into a ModuleExp (I'm guessing here you are calling
call/cc inside a method in Foo).
A practical way to allow that could be to use a delimited continuation as
explained here:

https://andrebask.github.io/thesis/#other-control-operators-delimited-continuations

On Sun, 8 Aug 2021, 3:29 pm Arvydas Silanskas via Kawa, <kawa@sourceware.org>
wrote:

> I merged and got the original code mostly working (leaving optimization
> refactoring for later), but I ran into one major issue when creating
> benchmarks. It seems calling kawa from java gets conceptually broken if
> kawa classes are used directly. New call/cc requires top level handling
> loop, which gets bypassed if I instantiate and use directly, like
>
> ```
> var foo = (FooInterface) Class.forName("Foo").newInstance();
> foo.bar();
> ```
>
> where FooInterface is an interface written in java, and Foo is a class
> created by `define-simple-class` on kawa side which specifies said
> interface as one of its supers.
>
> * Am I using the recommended approach for java -> kawa interaction?
> * If yes to the first question, do we strongly care that this type of
> calling gets broken as a compromise? After all the (optionally enabled, by
> default disabled) full continuations will weaken interop anyway, so maybe
> this is not worth trying to save. I'm not certain what a fix would be,
> maybe some sort of custom equivalent to Class.forName, which would return a
> proxied class with the handling loop attached to the methods.
> * The points about using CPStyle / CALL_WITH_TAILCALLS from what I can
> understand are purely regarding optimizations, right? Or do you think that
> refactored code using those approaches would also solve the problem above?
>
>
> 2021-06-10, kt, 02:27 Per Bothner <per@bothner.com> rašė:
>
> >
> >
> > On 6/9/21 2:04 AM, Arvydas Silanskas wrote:
> > > Has anyone taken up on this? If not, I'll give it a try.
> >
> > As far as I know, nobody has stepped up, or is working in this.
> > Great if you want to step up.
> >
> > Do read my previous message carefully - though note that
> > 'usingSPSStyle' should be 'usingCPStyle'.
> > --
> >         --Per Bothner
> > per@bothner.com   http://per.bothner.com/
> >
>
>


More information about the Kawa mailing list