06/30/2016, 3:53 PM
It’s not really specific to kotlin. It’s like duck typing, but you basically do something like:
Copy code
interface A {
    fun foo()

class B {
    fun foo() {}

class C {
    fun bar() {}

val good: A = A::class from B() // Creates a wrapper for A() which implements B
val bad: A = A::class from C() // Throws an exception because the structures don’t match
Basically, it’s a way to not hard code a dependency at compile time.
would just be an infix operator which attempts to create a wrapper extending the interface, if the instance could have implemented the interface.