What's difference between CoroutineScope(<Dispatch...
# coroutines
v
What's difference between CoroutineScope(Dispatchers.IO) + Job() and CoroutineScope(Dispatchers.IO+ Job())
m
It's the same thing:
Copy code
/**
 * Adds the specified coroutine context to this scope, overriding existing elements in the current
 * scope's context with the corresponding keys.
 *
 * This is a shorthand for `CoroutineScope(thisScope + context)`.
 */
public operator fun CoroutineScope.plus(context: CoroutineContext): CoroutineScope =
    ContextScope(coroutineContext + context)
I wish I could "open in github" from IntelliJ depenencies but if you look for
CoroutineScope.kt
in the coroutines repo, you'll find it
CoroutineScope(<http://Dispatchers.IO|Dispatchers.IO>)
will add a Job by default so you can leave out the Job in all cases
d
The latter elides an object allocation, so prefer that one if it makes sense in your code.
👍 1
v
@mbonnin I can see in this method
👍 1