Rodrigo Silva
04/07/2020, 1:52 AMSuspension functions can be called only within coroutine body
Rodrigo Silva
04/07/2020, 1:53 AMRodrigo Silva
04/07/2020, 1:56 AMZach Klippenstein (he/him) [MOD]
04/07/2020, 2:02 AMforEach
method on records
?Zach Klippenstein (he/him) [MOD]
04/07/2020, 2:02 AMRodrigo Silva
04/07/2020, 2:04 AMZach Klippenstein (he/him) [MOD]
04/07/2020, 2:05 AMforEach
functions, with different signatures.Rodrigo Silva
04/07/2020, 2:05 AMpublic inline fun <T> Iterable<T>.forEach(action: (T) -> Unit): Unit {
for (element in this) action(element)
}
Zach Klippenstein (he/him) [MOD]
04/07/2020, 2:05 AMproducerEvent
?Rodrigo Silva
04/07/2020, 2:06 AMZach Klippenstein (he/him) [MOD]
04/07/2020, 2:06 AMonErrorCallback
and onSuccessCallback
parameter types are regular functions, not suspend functions, so you can’t call producerEvent
from them, which is a suspend function.Rodrigo Silva
04/07/2020, 2:08 AMsuspend
() -> UnitZach Klippenstein (he/him) [MOD]
04/07/2020, 2:08 AMZach Klippenstein (he/him) [MOD]
04/07/2020, 2:10 AMretriable
inline, and not suspending, since it’s just a loop+try/catch. Inline functions’ function arguments can be suspending if the inline function is called from a suspend function.Rodrigo Silva
04/07/2020, 2:11 AMsuspend
because of the delay
Zach Klippenstein (he/him) [MOD]
04/07/2020, 2:12 AMZach Klippenstein (he/him) [MOD]
04/07/2020, 2:13 AMretriable
to just throw the exception.Rodrigo Silva
04/07/2020, 2:19 AM