so, “explicit concurrency” suggests: > every f...
# coroutines
v
so, “explicit concurrency” suggests:
every function that is declared as extension on CoroutineScope returns immediately, but performs its actions concurrently with the rest of the program.
i.e.,
suspend fun
is a non-blocking, waiting function; while functions declared on
CoroutineScope.foo
are non-blocking, “spawn something else concurrently” function; what is the idiomatic way to do this in a class that already inherits
CoroutineScope
?
is
launch
the primary differentiator?
d
Some opinions (including mine) would say you shouldn't extend
CoroutineScope
.
☝️ 1
The idiomatic way depends on why you are extending
CoroutineScope
.
v
hmm, I realize that is not required; I was doing something like this, so that all functions are in the same scope
Copy code
class Foo(ctx) : CoroutineScope by CoroutineScope(ctx) {
  suspend fun foo1() { ... }
  suspend fun foo2() { ... }
  ...
  suspend fun run() {
    foo1()
    foo2()
    ...
  }
}
now I realize that foo1 .. fooN will have the same scope as run anyway --- other possibility is I still haven’t grok’ed scope inheritance