Is it possible to specify the type of a function r...
# announcements
m
Is it possible to specify the type of a function reference in the very same expression I'm referencing in? for example, instead of
Copy code
val function: ((Char) -> Unit) = ::println
println(function)
something like
Copy code
println(::println) // but this fails because it's ambiguous
c
println(::println as (Char) -> Unit)
if I remember correctly.
m
I tried that (including the missing parentheses) but it didn't work. It seems the compiler tries to get the reference and then cast it
so the error is the same