gaetan
02/01/2018, 12:28 PMfun main(args: Array<String>) {
sayHello().talk()
}
fun sayHello() = HelloGenerator().apply {
//talk = this::helloFunction // <- OK on jvz and js
talk = ::helloFunction // <- OK on jvm, KO on js
}
class HelloGenerator {
var talk: () -> Unit = ::helloFunction
fun helloFunction() { println("hello world") }
}
anton.bannykh
02/01/2018, 1:02 PManton.bannykh
02/01/2018, 1:03 PMthis
anton.bannykh
02/01/2018, 1:11 PMgaetan
02/01/2018, 1:28 PMgaetan
02/01/2018, 1:49 PMgaetan
02/01/2018, 2:05 PManton.bannykh
02/01/2018, 2:06 PMgaetan
02/01/2018, 2:06 PManton.bannykh
02/02/2018, 11:41 AM