Colton Idle
07/21/2024, 3:01 PMAlex Vanyo
07/22/2024, 5:15 PMCoroutineScope
, 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.Colton Idle
07/23/2024, 1:49 PMPatrick Steiger
08/03/2024, 8:11 PMCoroutineScope
as a CoroutineContext
that, by convention, has a Job
, and as such is able to launch new coroutines constrained by structured concurrency.
It’s a specialization of the CoroutineContext
with a different name and purpose