They definitely can be. I always reason about them converting to callbacks in my head:
"Resume a coroutine" = invoke a callback
"Suspend a coroutine" = pass a callback to something
"Call a suspend function" = pass a callback to the function
"Dispatch a coroutine" = post a callback on an executor
"Channel" = blocking queue that accepts callbacks instead of actually blocking.
Everything else is just shorthand for talking about callbacks.
☝🏼 4
c
Chills
01/26/2020, 4:44 PM
channel are similar to goroutines
z
Zach Klippenstein (he/him) [MOD]
01/26/2020, 4:56 PM
They are similar to channels in Go, yes. Afaik the only differences are that Go's channels are always finite, kotlin allows unbounded ones.
c
Chills
01/26/2020, 5:05 PM
go routines channel are more with hardware and coroutines are more with functions 🙂