Single Thread Continuation

Pedro Lamarão pedro.lamarao at prodist.com.br
Wed Jul 5 13:53:40 UTC 2023


Em qua., 5 de jul. de 2023 às 09:13, Robert Engels <rengels at ix.netcom.com>
escreveu:

> The generator is closed in response to yield() - this could have been an
> exception as well. It is also “closed” if it returns for any reason
> including an exception. It is all built into the framework - the dev does
> not need to code anything special.
>
> The code is less than 150 lines for the complete generic implementation.
> The code to write and use a generator can be a single line. How much
> simpler do you need?
>
>
Here are my three variant designs jdk.internal.vm.Continuation based
generators, each in around 35 lines.
RunnableGenerator comes directly from an earlier Loom presentation by Alan
and Ron.
After doing the heavy work of introducing delimited continuations, doing
generators should be a breeze.
With optimized generators, there will be no choice between efficiency and
maintainability when implementing data parsers and similar machines.

https://github.com/pedrolamarao/generators-jvm/blob/main/generators/src/main/java/br/dev/pedrolamarao/generators/

-- 
Pedro Lamarão
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230705/f3d2dde0/attachment.htm>


More information about the loom-dev mailing list