-
Can we add a command that corresponds to This command can be simulated with multiple instructions (suspend.all $k)
(loop $relay
(suspend $yield (local.get $k))
(br $relay)
) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
This instruction would probably be too high-level for WebAssembly. Different producers would want different behavior. For example, should the yielded values be stored in a memory? in a table? in an array? dropped? It's better to provide the low-level building blocks and let producers implement exactly what they need rather than trying to provide such high-level operations directly. |
Beta Was this translation helpful? Give feedback.
-
Following on from Thomas's remarks: definitely too high-level and language specific. |
Beta Was this translation helpful? Give feedback.
-
It's a pattern. The idea is that yield has an additional (potentially implicit) argument: the identity of the generator coroutine that is yielding. |
Beta Was this translation helpful? Give feedback.
This instruction would probably be too high-level for WebAssembly. Different producers would want different behavior. For example, should the yielded values be stored in a memory? in a table? in an array? dropped? It's better to provide the low-level building blocks and let producers implement exactly what they need rather than trying to provide such high-level operations directly.