Question about async programming

2023-01-06 Thread gcao
Thank you all. I'll leave it as is. For a pet language, I want to add all features I like in other languages, plus more :-P For the multithread support, I'm creating new VM for each thread, and use channels to communicate. Will see how it evolves as I add more use cases.

Question about async programming

2023-01-06 Thread Araq
> Is this something I need to worry? Or is this part of async programming and > we all must live with? You must live with it as far as I can tell. For a "pet" language I wouldn't add async. ;-) Just make the interpreter re-entrant instead and build some of our nice multi-threaded server softwar

Question about async programming

2023-01-06 Thread auxym
I am far from an expert on this, but my understanding of nim and python async runtimes, is that task switches (check for pending future, etc) _only_ happen when the routine that is currently running invokes `await` (or finishes). `await` explicitly pauses your routine and gives the control back

Question about async programming

2023-01-06 Thread gcao
Hi, I added async support to my pet language and after reading more about async programming, I have some questions. Currently, in my interpreter, after every X evaluations, the interpreter will check whether there are pending futures and if yes, check their states, call the success or failure