Concurrency Overview in Verse
An expression in Verse can be either immediate or async. This describes the time an expression can take to evaluate relative to simulation updates.
Think of a simulation update as when a new frame is shown.
There are cases when multiple simulation updates can occur before a new frame, such as if an online game goes out of sync with the server.
| immediate | async |
|---|---|
| An immediate expression evaluates with no delay, meaning that the evaluation will complete within the current simulation update. | An async expression has the possibility of taking time to evaluate, but doesn’t necessarily have to. An async expression may or may not complete in the current simulation update, or in a later one. |
Async Contexts
Async expressions can be used in any Verse code that has an async context.
An async context is the body of a function that has the suspends effect specifier. The suspends effect indicates that async functions can suspend and cooperatively transfer control to other concurrent expressions at various points over several simulation updates before they complete.
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.