Hey guys, is is possible to pass the reference of ...
# announcements
a
Hey guys, is is possible to pass the reference of a method with the implicitly "this"? The following code doesn't compile:
Copy code
object Foo {
    private val hey = "Hello,"

    fun hello(value: String) {
        println("$hey $value")
    }

    fun bar() {
        ref(Foo::hello)
    }

    fun ref(f: Foo.(String) -> Unit) {
        f.invoke(this, "World")
    }
}
The "ref(Foo::hello)" doesn't type match. Any help? 🙂