christopher
06/30/2016, 3:53 PMinterface 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. from
would just be an infix operator which attempts to create a wrapper extending the interface, if the instance could have implemented the interface.