I have a code style best practices question.
Let’s say I have the following code:
class ClassWithFairlyLongName {
var data: Int = 2
init {
foo {
this@ClassWithFairlyLongName.data = data
}
}
}
class Foo() {
var data: Int = 3
}
fun foo(init: Foo.()->Unit): Foo {
val f = Foo()
f.init()
return f
}
What do people do in this case? this@ClassWithFairlyLongName is rather long and ugly.
I’m not in love with val r = this before the receiver changes, and in the case I’m struggling with it doesn’t make sense to change the name of data
.
-N