Can't yield from within an instance created by reflection
Alan Bateman
Alan.Bateman at oracle.com
Tue Apr 6 15:10:35 UTC 2021
On 06/04/2021 15:29, Øystein Myhre Andersen wrote:
>
> That's a pity to remove such a basic feature. I am working on an open
> source project to implement Simula using Java. As you probably know,
> Simula was a great inspiration to James Gosling when he defined Java.
> Kristen Nygaard and Ole-Johan Dahl strongly believed that basic
> concepts were the thing. And I see Delimited Continuations as an
> important basic concept. Simula introduced Quasi-parallel systems to
> define discrete event simulation. You want to use it for virtual
> threads but it is possible that there are somebody out there who will
> use it for eg artificial intelligence. Why stop that opportunity - I
> will use it to implement Simula coroutines ( QPS Sequencing).
>
>
> By the way, I have also written an implementation that uses
> oversynchronized threads. Platform threads works well but virtual
> threads do not. There is something wrong there. I will return when it
> has been analyzed more thoroughly.
>
>
> If you are interested, the Simula project can be found here:
>
> https://portablesimula.github.io/github.io/
> <https://urldefense.com/v3/__https://portablesimula.github.io/github.io/__;!!GqivPVa7Brio!JNUrhq9WTpQQqmLyjbcrT062Xy0A2NUQvg5fZuffY9p7H9dOD130REg_AxisbmwmpA$>
Thanks for the link to the project implements Simula coroutines.
Delimited continuations is a powerful primitive but not one that this
project plans to expose at this time. One significant issue is that
yielding on one thread and continuing on another would break the
invariant that Thread.currentThread() doesn't change in a thread of
execution. Thread locals, lock ownership and several other features
would break. There is also the issue as to whether the control flow
would be just too advanced for many developers. It might be that
generators or some other feature that will use thread-confined
coroutines but for now, our focus is on virtual threads.
-Alan.
More information about the loom-dev
mailing list