Continuations before Fibers

Alen Vrečko alen.vrecko at gmail.com
Thu Mar 5 18:52:54 UTC 2020


Hello, everyone.

On your website you have this:

Continuations are intended as a low-level API, that application authors are
not intended to use directly. They will use higher-level constructs built
on top of continuations, such as fibers or generators.

I took the current EA build for a spin. There is support for Continuations.
It solves my use case.

I've put an example of how I'd use continuations here:

https://gist.github.com/avrecko/a706484e6d7f4963af75a042006f8a4a

Basically using Continuations with a SEDA style application. The current EA
build implementation looks like it works as expected and solves my use case.

Is this something you would _not_ like the users to do? I can see myself
using this kind of approach in production very easily without drastic
changes to the existing code base and without much surprises.

Briefly looking at the code of Continuation. It looks thread safe. So there
shouldn't be problems from passing it around and being executing in part
from different threads.

I do find the Scope argument a bit annoying. I think you could provide an
implicit default scope. So unless explicitly specified an implicit -
default scope is assumed.

In my view you should consider releasing Continuations before Fibers and
making Continuations part of public api to be used by developers.

I find the current API pretty intuitive to use. Minus the scopes. I like
that #run() is final and that Continuation takes Runnable. Makes sense to
me.

Best regards
Alen


More information about the loom-dev mailing list