there is, coroutineScope is suspend function and it will be cancelled when suspend function is cancelled
launch {} will not be cancelled if
join()
call is cancelled (only when parent Job of this launch is cancelled)
z
Zach Klippenstein (he/him) [MOD]
09/29/2020, 5:24 PM
That distinction is true, but if the receiver of launch in that example is the same scope as the coroutine is running in, then they're effectively the same as far as cancellation goes.
Error propagation is different too though, if an exception is thrown inside launch, it will fail the parent scope. If an exception is thrown inside of coroutineScope, it will just be thrown to the caller, without automatically cancelling its scope.