Jakub Gwóźdź
12/10/2022, 8:01 AMfoo
and bar
.
in bar.Baz.kt
I have this:
package bar
fun baz(i: Int) = i + 1
and in foo.Foo.kt
this:
package foo
import bar.baz
fun xd(op: (Int) -> Int) {
println("calling $op with param 4 and getting ${op(4)}")
}
fun main() {
xd(::baz)
}
everything works great.
now I want to get rid of import bar.baz
. How do I do that? xd(::bar.baz)
does not compile. What’s the syntax here?rkechols
12/10/2022, 8:23 AMJoffrey
12/10/2022, 8:25 AMJakub Gwóźdź
12/10/2022, 8:26 AMimport
(and of course without switching to lambda)Joffrey
12/10/2022, 8:37 AMRob Elliot
12/10/2022, 10:00 AMimport bar.baz as baz
import bar2.baz as bar2baz
fun main() {
xd(::baz)
xd(::bar2baz)
}
Jakub Gwóźdź
12/10/2022, 10:11 AM