am I correct in my assumption that channels is at-...
# coroutines
g
am I correct in my assumption that channels is at-most-once delivery? E.g. if you have a channel with 5 "processors" that iterates over the channel, none of them will get any duplicates
e
Yes, that’s what I was told here a few days / a week back. Something about it implementing iterable and making sure every element is only processed once. The experimental function
channel.consumeEach {}
-says so quite explicitly in the name. Each element is consumed by its “processor”, preventing duplicate processing. According to the library it’s currently experimental with planned graduation in 1.4, and it is apparently just an alias for the
for (element in channel)
-syntax.
d
It's not quite an alias.
consumeEach
closes the channel after every element has been received or the receiver throws an exception.
for-in
does not do that.
g
thanks a lot, what you are saying is how I've interpreted it as well...so I guess the documentation is good 😄
r
BroadcastChannel
simple smile
😛 1