<div dir="ltr"><div dir="ltr">Em qua., 5 de jul. de 2023 às 09:13, Robert Engels <<a href="mailto:rengels@ix.netcom.com">rengels@ix.netcom.com</a>> escreveu:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="ltr"></div><div dir="ltr">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. </div><div dir="ltr"><br></div><div dir="ltr">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?</div><div dir="ltr"><br></div></div></blockquote><div><br></div><div>Here are my three variant designs jdk.internal.vm.Continuation based generators, each in around 35 lines.</div><div>RunnableGenerator comes directly from an earlier Loom presentation by Alan and Ron.</div><div>After doing the heavy work of introducing delimited continuations, doing generators should be a breeze.<br></div><div>With optimized generators, there will be no choice between efficiency and maintainability when implementing data parsers and similar machines.</div><div><br></div><div><a href="https://github.com/pedrolamarao/generators-jvm/blob/main/generators/src/main/java/br/dev/pedrolamarao/generators/">https://github.com/pedrolamarao/generators-jvm/blob/main/generators/src/main/java/br/dev/pedrolamarao/generators/</a><br></div><div><br></div></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Pedro Lamarão</div></div></div></div>