Ayden
08/22/2018, 12:22 PMinline fun <T, R> with(receiver: T, block: T.() -> R): R (source)
I don't really understand what is this trying to explain although I have read through the explanation.
I know T might stands for Type but what does R stands for? Run?
The receiver is the argument we pass into it?
What is block?
R i would assume it is the result then.
Am I right?diesieben07
08/22/2018, 12:25 PMT and R are type variables: https://kotlinlang.org/docs/reference/generics.html
The names do not really mean anything in this context, usually people name their first type parameter T and then continue down the alphabet.diesieben07
08/22/2018, 12:25 PMLucas Ł
08/22/2018, 12:30 PMinline fun <TParam, TResult> with(receiver: TParam, block: TParam.() -> TResult): TResultUzi Landsmann
08/22/2018, 12:53 PMAyden
08/22/2018, 1:10 PMinline fun functionName<T, R>(parameter: T) -> TResult
Something similar like this?Lucas Ł
08/22/2018, 1:15 PM