I got a stupid question. Is using m/blk when converting a (fn[]) to a task the same thing under the hood the same thing as (m/? task) inside a m/sp?
m/sp returns a task which will, by default, run in the current execution context, so if you run it in a JVM Clojure REPL it will block on the execution of the task. (m/via m/blk ,,,) returns a task which, when run, will run in the given executor. But I guess if you m/? on that task in a JVM Clojure REPL, the REPL will block until that task completes. So although in the first case the task is running in the same thread as the REPL and in the second case it is running in a different thread, the observable effects will be similar. But it is not the same thing under the hood.
I did some more thinking: so a missionary task is required to be cooperative; meaning it can only do operations that don't take a lot of time. A clojure function does not meet this requirement; for this reason m/via was created. So guess that clojure functions run via m/blk or m/cpu go to one of two threadpools. I was wondering why there is no api to send a task to one of m/blk or m/cpu. I get it now: inside a task a time consuming call can ve iffloaded directly. So there is no need .. can be done inside the m/sp expression. But what znow wonder is what is the difference in an ap process that forks off subprocesses. Is it always clear that the fork cpu bound? What if the firk had to (m? ...) something to pass data elsewhere; say to another ap that writes values to disk. Isn't that then a io bound fork? I hope I am not seen as pedantic. It is just that missionary api is so powerful that one really had to think twice about everything.
> I did some more thinking: so a missionary task is required to be cooperative; meaning it can only do operations that don't take a lot of time. A clojure function does not meet this requirement; for this reason m/via was created. So guess that clojure functions run via m/blk or m/cpu go to one of two threadpools. I was wondering why there is no api to send a task to one of m/blk or m/cpu. I get it now: inside a task a time consuming call can ve iffloaded directly. So there is no need .. can be done inside the m/sp expression.
This is correct. In general, any effect that is not an m/via is not bound to a single thread, in practice it should be expected to run on multiple threads successively during its lifecycle.
The rest of the paragraph I don't quite understand