Hi! I would like to propose the following extensio...
# stdlib
b
Hi! I would like to propose the following extensions to `kotlin.reflect.K[Mutable]Property`:
Copy code
operator fun <T> KProperty0<T>.getValue(thisRef: Any?, property: KProperty<*>) = get()
operator fun <T> KMutableProperty0<T>.setValue(thisRef: Any?, property: KProperty<*>, value: T) = set(value)
This would let me use bound callable references as a property "alias". This enables me to write:
Copy code
var propertyAlias by property1::property2
Otherwise, in order to to get the same functionality, I would need to write a custom getter/setter:
Copy code
var propertyAlias
    get() = property1.property2
    set(value) {
      property1.property2 = value
    }
I believe this is a common enough scenario to warrant a
stdlib
addition. Thank you.