On Sun, Mar 9, 2025, at 8:17 AM, Rowan Tommins [IMSoP] wrote:

> That leaves the question of whether it would ever make sense to nest 
> those blocks (indirectly, e.g. something() itself contains an async{} 
> block, or calls something else which does).
>
> I guess in our analogy, nested blocks could be like running Containers 
> within the currently running OS: they don't actually start a new 
> Scheduler, but they mark a namespace of related coroutines, that can be 
> treated specially in some way.
>
> Alternatively, it could simply be an error, like trying to run the 
> kernel as a userland program.

Support for nested blocks is absolutely mandatory, whatever else we do.  If you 
cannot nest one async block (scheduler instance, coroutine, whatever it is) 
inside another, then basically no code can do anything async except the top 
level framework.

This function needs to be possible, and work anywhere, regardless of whether 
there's an "open" async session 5 stack calls up.

function par_map(iterable $it, callable $c) {
  $result = [];
  async {
    foreach ($it as $val) {
      $result[] = $c($val);
    }
  }
return $result;
}

However it gets spelled, the above code needs to be supported.

--Larry Garfield

Reply via email to