gabrielborges
12/20/2015, 10:54 PMT.run and with(receiver: T), which let me access an object's fields etc. as if I was inside the object. I can then nest those calls to expand the results:
val v = objectT.run {
somePropertyOfT.run {
// some code here
}
}
// some code here has both the scope of objectT and objectT.somePropertyOfT. I need both scopes, so I can't just call objectT.somePropertyOfT.run.
I was wondering if Kotlin would allow me to somehow define multiple receivers in the signature of a function. Something like f: (T, R).() -> Unit in a customised run function. My end goal is to replace // some code here with a function without losing any scope.