https://kotlinlang.org logo
#feed
Title
s

Shailesh Sengar

03/22/2019, 12:37 PM
Folks, i wrote an article on Kotlin Coroutine Scope: https://medium.com/@shaileshsengar21/kotlin-coroutine-scopes-377219274461 I would appreciate feedback. Thanks.
👍 5
d

Dico

03/22/2019, 1:02 PM
I think theres a bit of an error relating to the part where you list different scopes. Specifically ProducerScope and ActorScope. I believe you are referring to different coroutine builders in the explanation for these. The scope can't determine what coroutine builder should be used. Not trying to be rude, correct me if I'm wrong, but I believe these symbols do not exist.
b

bdawg.io

03/22/2019, 5:38 PM
ActorScope
and
ProducerScope
are interfaces of a standard
CoroutineScope
that also has reference to an open
Channel
. It could be misleading to even mention them since they have no special behavior in terms of Coroutine Scopes.
d

Dico

03/22/2019, 6:08 PM
Oh, I didn't know, but that makes sense.
s

Shailesh Sengar

03/25/2019, 3:30 AM
Bradyn is right,
ActorScope
is interface of
CoroutineScope
+
ReceiveChannel
and
ProducerScope
is interface of
CoroutineScope
+
SendChannel
. Both can be use in Coroutine channel. ProducerScope is scope for produce coroutine builder (https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/produce.html). Also ActorScope is scope for Actor coroutine builder (https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/actor.html) I didn’t explain channel in this article because
Channel
is not stable yet. Thanks for the feedback.
2 Views