Matt Thiffault
10/21/2019, 7:55 PMoctylFractal
10/21/2019, 8:11 PMselect
?for (c in list) c.onX {}
Matt Thiffault
10/21/2019, 8:12 PMoctylFractal
10/21/2019, 8:13 PMbdawg.io
10/21/2019, 9:45 PMval receivingA: SelectClause1<Foo> = channel.onReceive
select { // this: SelectBuilder<Foo>
receivingA { it }
}
The key thing is that you invoke
on the SelectClause returned by the onReceive
property from inside of the SelectBuilder
contextinvoke
extension methods are found here in source: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/common/src/selects/Select.kt#L20-L52