Ive Vasiljevic
07/09/2019, 12:15 PMwith
inline function has a receiver and another function that behaves as extension function, so that receiver is able to execute that function on it self. My question is how does that inline function accept multiple lines of code that need to be executed?Ive Vasiljevic
07/09/2019, 12:17 PMcallsInPlace(block, InvocationKind.EXACTLY_ONCE)
dalexander
07/09/2019, 1:22 PMIve Vasiljevic
07/09/2019, 2:02 PMwith(item) {doSomething() doSomething()...}
Is with
inline function called for every doSomething() that is inside of the brackets?ilya.gorbunov
07/09/2019, 2:15 PMwith
function takes the item and invokes the entire code block passed in the lambda with item as a receiver.
The code above is equivalent to something like this:
val receiver = item
receiver.doSomething()
receiver.doSomething()
...