This message was deleted.
# getting-started
s
This message was deleted.
y
I haven't looked into this compiler-wise, but the mental model is exactly that there's a callable overload automatically generated for it. E.g:
Copy code
fun interface Foo { fun foo() }
// Is translated into
interface Foo { fun foo() }
fun Foo(impl: () -> Unit) = object: Foo { override fun foo(): Unit = impl() }
Like any other callable overload, the import will bring both in. That's because
import bar.baz.Foo
always brings in the type named
Foo
if it exists, and any functions in that package named
Foo
. Again, idk the compiler magic here, so it might be the case that this callable overload is actually always inlined or something, or that maybe
Foo
is magically both a type and a callable (as if it had a constructor).
Only reason is that it's not there in the binary From the docs linked above for migrating from callable overload to
fun interface
, they suggest to keep the callable overload as deprecated hidden for binary compatibility
An inline function still exists in the bytecode, this doesn't. If you're not a library developer (and have no java classes that use this code), you're fine