https://kotlinlang.org logo
#coroutines
Title
# coroutines
r

rocketraman

11/01/2018, 5:07 PM
Another question: why does
CoroutineScope.writer
et al in
<http://kotlinx.coroutines.io|kotlinx.coroutines.io>
take a
coroutineContext
? Can't it get it from the receiver
CoroutineScope
?
z

Zach Klippenstein (he/him) [MOD]

11/01/2018, 6:33 PM
Normally functions that do this add the passed-in context to the context from the scope, to allow you to easily override the context for the new coroutine without creating a new scope. Usually that context parameter is optional though, and I’m not sure why it wouldn’t be here. File a bug?
r

rocketraman

11/02/2018, 6:21 AM
I have seen that pattern before, and yup, I would have expected this parameter to be optional as well.
3 Views