Thread
#stdlib
    u

    uliluckas

    3 years ago
    Hi there, is there a reason not to have a type parameter for the delegate on a
    KProperty
    ? if there was, one could write extension functions, depending on the delegate type. I.e.
    fun KProperty<*, BehaviorRelayDelegate>.subscribe(O: Observer)
    and use it like
    val v : Int by BehaviorRelayDelegate(0)
    ::v.subscribe { Log("Value changed to $it" }
    v = 2
    val v1 = v
    ilya.gorbunov

    ilya.gorbunov

    3 years ago
    Property delegation is considered an implementation detail of a property, thus a statically reflected
    KProperty
    cannot expose that detail, i.e. the delegate type.