Edit 2: I've been attempting to diagram the state transitions of a flow. This is still incorrect; it implies the producer can only call the notifier or the terminator after the producer returns or throws from the deref, but the producer can call either during the deref and then return or throw. This Mermaid diagram shows the state transitions in a flow: https://mermaid.ink/img/pako:eNqVUkFqwzAQ_IrQyQbnAz70ktBjKTSn4MsirWOBrTUrqWmJ8_fKkZzULZTUl50dzc4sks9SkUZZy7ank-qAvdjvGivi98qkg8Ii13LFis3maRoTZmHJm9agm8SWrAsD_qH1yIOx4Gf1fsE6DeTpItcceVcVd1iuJq4RKuEYwWBdi-wqcYtl9IGtE-_QB5yW1f5p4jumkxP4oXD0huwknsH0y_Yv5LdgFUaiiFgsTfnreJ2krux8efk4b7V4_fB52CTJ04ZFKuV37rF3kZWM_gMYHf-S8zzfSN9hfGNZR6ixhdD7Rjb2EqUQPL19WiVrzwEryRSOnaxb6F3swqij6c7AkWG4sSPYA9HSX74ALZLmEw?type=png Source: https://mermaid.live/edit#pako:eNqVUkFqwzAQ_IrQyQbnAz70ktBjKTSn4MsirWOBrTUrqWmJ8_fKkZzULZTUl50dzc4sks9SkUZZy7ank-qAvdjvGivi98qkg8Ii13LFis3maRoTZmHJm9agm8SWrAsD_qH1yIOx4Gf1fsE6DeTpItcceVcVd1iuJq4RKuEYwWBdi-wqcYtl9IGtE-_QB5yW1f5p4jumkxP4oXD0huwknsH0y_Yv5LdgFUaiiFgsTfnreJ2krux8efk4b7V4_fB52CTJ04ZFKuV37rF3kZWM_gMYHf-S8zzfSN9hfGNZR6ixhdD7Rjb2EqUQPL19WiVrzwEryRSOnaxb6F3swqij6c7AkWG4sSPYA9HSX74ALZLmEw
I'm reminded of Leslie Lamport's comment that he didn't find state diagrams very useful, I think I may understand what he was getting at.
Is it possible to call cloroutine continuations from the same break multiple times? Atm. it steps when it is called to the next point as far as I understand. (reading the code again...)
Thanks for sharing. I will take a look and reply there. It might take me a few days though. Do you have a deadline?
I don't
Please share your thoughts
Ok, interesting. What are you thinking about? Anglican does CPS here https://bitbucket.org/probprog/anglican/src/ab6111d7fa8f68f42ea046feab928ca3eedde1d7/src/anglican/trap.cljc#lines-644, which is somewhat a lean pure S-expression based approach, but its support for Clojure was not complete and it was sometimes difficult to debug since it got stuck in endless loops somehow. I have not spent a lot of time trying to figure it out, but I got cloroutine to work in SCI (babashka) earlier and am implementing a forking operation for it right now, which would allow me to use it as an isolated simulation environment that supports a sizeable subset of Clojure, so the cloning could be very powerful to generalize Anglican like this.
Where I can both fork the SCI env/interpreter and the remaining continuation from outside the interpreter.
Just as a side note: I think my earlier questions with respect to forking FRP state were ill-posed btw. I think you have to basically fork the interpreter and I don't think it is possible to fork computations that operate over mutable data structures in a reasonable way (e.g. flows or CSP channels). I think I will opt to an idempotent, durable and persistent message processing (similar to replikativ or Rama) and "reboot" missionary or core.async after an interpreter fork with new bindings and message delivery mechanisms. Maybe I can keep track of message delivery in Datahike for now, its performance should be good enough for that and it can be easily forked even with durability on (which Datomic cannot).
Found it, you can invoke the continuation with a copying function, which is very cool. Is there a particular reason for this interface? (I need to check missionary again, I guess it is used by it)
The cloning feature was an afterthought
There are several problems with the current cloroutine API, I'm actively thinking about an alternative
The changes I'm planning to make in cloroutine - https://github.com/leonoel/cloroutine/issues/32