We have functional interfaces/single abstract meth...
# stdlib
m
We have functional interfaces/single abstract method (SAM) interfaces e.g.
Copy code
fun interface MyInterface {
    fun myMethod(): Int
}
which can be created with a lambda
Copy code
val myInterface: MyInterface = { 4 }
but is there an equivalent for single abstract property interfaces? It could look like
Copy code
fun interface MyInterface {
    val myProperty(): Int
}
and be called like
Copy code
val myInterface: MyInterface = 4
I believe this would be slightly different from
typealias
, as explained in https://kotlinlang.org/docs/fun-interfaces.html#sam-conversions