A way I think about it which might be useful:
If I see a
CoroutineScope
, I expect that it is a fully formed and valid scope that I can launch things into, and pass around as a scope, and is generally participating in structured concurrency.
If I see a
CoroutineContext
, it could be entirely empty, or just contain one thing (like a dispatcher) that I am collecting together in order to eventually create a new, fully formed
CoroutineScope
later
It's very roughly like a
CoroutineContext
is a
Builder
of stuff related to coroutines, and then eventually it gets built into a
CoroutineScope
.
If you have a normal
Builder
for something, it'd be strange to do anything to the in-progress builder except continuing to make tweaks - It's only once you call
.build()
that you'd actually want to do things on the data type since now you have a "fully formed" object.