https://github.com/leonoel/missionary/issues/127#issuecomment-2607165823 @leonoel when running a task with (task success-fn error-fn) does it run on a thread from m/blk?
a task generally doesn't run on a single thread and doesn't use the m/blk executor unless being told so
but since this form of invoking a task is not blocking the thread where I use it, I assume it runs on a separate thread?
it depends how it's defined
most likely yes, unless it's a very trivial task
But the issue you linked can happen on any thread, the problem is the dynamically scoped context of m/sp. The reason why your hack works is because switching thread restores the dynamic scope
the correct fix is to identify calls containing nested m/?, wrap them in m/via and sequence them in a m/sp
is it something that has to be done manually or it can be done by missionary?
in the meantime does it mean that I should "bubble up"? turn functions into task all the way to the final invokation?
it cannot be done by missionary, we would need stackful coroutines for that
yes, use task composition as much as you can
after a task has been turned to a blocking call there's no way to get it back
m/? in an m/sp is still task composition right? it's only free m/? that would do that?
yes, the m/? has to be visible to the macro so it can be rewritten as an asynchronous operation
ok thanks I understand better now