czyzby
04/18/2017, 9:22 AMclass Test {
val test: String
init {
build {
test = "This does not compile."
}
// test = "This would compile."
}
}
inline fun build(action: () -> Unit) {
action()
}
I don't want to use lateinit var, if possible. I've encountered this problem when using type-safe building API that requires a lot of nesting. Imagine building a GUI and needing a reference to a single widget nested inside a few blocks.