Replies: 3 comments
-
a funcref is fine for me. |
Beta Was this translation helpful? Give feedback.
-
@rossberg, I was going to switch the explainer to use |
Beta Was this translation helpful? Give feedback.
-
Well, you'll have to pass that static function another function representing the thread to create as a parameter somehow. The cheap and most natural to do that is as a reference. Yes, you could take the detour through a global table by stuffing all references you ever want to call it with into that, but that complicates the interface with extra indirection and global state, which is totally unnecessary, unless you absolutely have to cook up an integer for other reasons. |
Beta Was this translation helpful? Give feedback.
-
The explainer suggests that spawn takes a function index. That might work for simple local parallelism, but would make it impossible to build any form of abstractions around threads and their management. I think this clearly needs to be a function reference to be sufficiently general.
Beta Was this translation helpful? Give feedback.
All reactions