According to the Verse glossary coroutines are synonymous with async functions. This is a bit of a departure from, say, C#, where coroutines are implemented with generators, while async functions are a framework over OS threads.
I assume (and this is a big assumption) to keep them lightweight that coroutines in Verse (ok I’ll have to start calling them async functions) are serviced during the game tick, as opposed to threads that will be serviced by the OS and will be asynchronous of the tick.
So will async functions be compatible with OS threads? I would assume through some sort of queue that will be drained when the game tick occurs?
And will it be a unified syntax? So I could make, for example, REST API calls in my async functions along with standard coroutine calls.
Verse is single-threaded, so they work the same as JavaScript async functions - when first called (such as from a spawn or race), they run up until they hit their first suspending function, then pass off to the next expression and resume when they’ve completed
Async functions like Sleep will run after a game tick since the function will complete when at least that amount of time has passed, while event.Signal will cause corresponding event.Await listeners to run immediately after, but always one at a time
Hah, yeah I just found Tim Sweeny’s “wild west” comment Thanks for your insight on this, I’m having a lot of fun with Verse, it’s got some interesting concepts, and begging lots of questions.