Chuck Stein
09/17/2022, 4:55 AMcoroutineScope
function waits for the block's completion before returning, but I want to just launch
something with the current scope, fire and forgetJoffrey
09/17/2022, 5:46 AMsuspend
functions should behave. Why use a suspend
function if you want to fire and forget? Just use a regular function defined as an extension on CoroutineScope
ephemient
09/17/2022, 6:32 AMlaunch
into the callers, make it explicit that they are firing-and-forgettingJoffrey
09/17/2022, 6:58 AMphldavies
09/17/2022, 1:01 PMChuck Stein
09/17/2022, 2:31 PMphldavies
09/17/2022, 2:35 PMlaunch
it. It will hold up normal completion of the scope (as it will wait for all children to complete) but not the calling function as you desire. It will also be cancelled when the scope is cancelled (or a failure occurs in the scope).phldavies
09/17/2022, 2:37 PMlaunch
on that rather than the enclosing coroutineScope
block (if any).Chuck Stein
09/17/2022, 2:37 PMlaunch
?phldavies
09/17/2022, 2:41 PMChuck Stein
09/17/2022, 2:41 PMcoroutineScope
function exists, which automatically gives us a reference to the current scope, shouldn't we be able to automatically get a reference to the current scope for my use case as well? Launching something and not waiting for it to return?Chuck Stein
09/17/2022, 2:42 PMphldavies
09/17/2022, 2:42 PMphldavies
09/17/2022, 2:44 PMChuck Stein
09/17/2022, 2:44 PMChuck Stein
09/17/2022, 2:45 PMChuck Stein
09/17/2022, 2:45 PMChuck Stein
09/17/2022, 2:47 PMphldavies
09/17/2022, 2:47 PMphldavies
09/17/2022, 2:48 PMChuck Stein
09/17/2022, 2:49 PMcoroutineScope
at all for my use case, I was just thinking I want to do something similar to what that function does in terms of reusing the outer scopelouiscad
09/18/2022, 12:52 AMCoroutineScope
as a parameter or receiver.Chuck Stein
09/18/2022, 7:42 PMlouiscad
09/18/2022, 7:52 PMlouiscad
09/18/2022, 7:53 PM