Is there a way to pass a property reference (basic...
# kotlin-native
d
Is there a way to pass a property reference (basically like a method reference to the getter and setter) to a function? I'd rather not pass in two lambdas.
j
now and then i see KProperty references when im doing function referenecs. 
d
Does it work on native though? I guess I could test it.
j
KProperty does have a severe drop-off of methods for non J-prefixed kotlin editions. i am using pairs of read/write lambdas so I am intrigued at the idea of finding a KProperty accessor to provide both.
d
Yeah,
KMutableProperty0
works perfectly.
j
i think for my purposes of a map with read/write helpers two lambdas is the simpler option.
d
I'd argue the property reference is simpler. All you have to do is use the
::
operator.
j
i have no references to point to atm so i would be manufacturing classes to hold functions to paramaterize, but in principal that's because of design choices i made to stick with typealiases and lambdas from the start. for me the fewest source code artifacts for my 20+ adapters is still as tuples of lambdas
do you have a source code delta of before and after using KProperty?
d
Not quite, it's a new project. So I pretty much started with it.