| I do agree with a lot of what you said. > While structured concurrency gives you this guarantee, this is orthogonal to whether a function the thread runs is "red" or "blue". I disagree with this. Making sure that threads join before return is a big reason why I can pass functions around easily as function pointers and not worry about it. An example is in my up-and-coming build system. [1] In that code, I have a function that opens a threadset (my term for trio's nurseries) and executes a build. Once my build system is out of alpha, the direct call to that function will be replaced by a function pointer to the build type of the user's choice. (For example, you might want a "quick build" to just rebuild a file saved by your editor, or a "full build" regardless of what is already built, or just a normal build.) Despite using function pointers, I don't need to worry about whether threads are spawned or not. In Zig, you do need to worry about if a function is async or not when using function pointers. This includes if I make a build type whose function will not spawn threads at all, by the way. (For example, if building on a platform where you don't have the memory to spare for extra threads.) I can use that build type's function as a function pointer the same way I would use any function that does use a threadset. In other words, while Zig is colorblind at compile time, structured concurrency is colorless at both compile time and runtime. [1]: https://git.yzena.com/Yzena/Yc/src/commit/a7f535f8d0df45120e... |