Is there any reason that there is no `SendChannel&...
# coroutines
d
Is there any reason that there is no
SendChannel<E>.sendCatching(e: E): ChannelResult<Unit>
like there is a
ReceiveChannel<E>.receiveCatching(): ChannelResult<E>
?
l
It's called
trySend()
d
@louiscad I mean there is a
receive
, a
receiveCatching
and a
tryReceive
with different semantics and behavior. However, there is only a
send
and a
trySend
, but no
sendCatching
. How is that? I would need a non-throwing and suspending version of
send
.
Or am I missing something?
v
Copy code
* [Closing][close] a channel _after_ this function has suspended does not cause this suspended [send] invocation
* to abort, because closing a channel is conceptually like sending a special "close token" over this channel.
* All elements sent over the channel are delivered in first-in first-out order. The sent element
* will be delivered to receivers before the close token.
So
sendCatching
would have the same semantics as
trySend
. That’s why there is no
sendCatching
and
onSendCatching
.