https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
j

Jan Stoltman

07/25/2019, 7:30 AM
Quick question, is there any K/Mp implementation of WeakReference?
👌 1
🤔 1
1
d

Dico

07/25/2019, 9:50 AM
j

Jan Stoltman

07/25/2019, 9:59 AM
As far as I know there is no WeakReference in Stately
There is only AtomicReference
I wrote my own implementation, most likely I will post it somewhere if there is no better alternative available
k

kpgalligan

07/25/2019, 12:19 PM
I could add one. Assume the implementation is pretty straightforward?
j

Jan Stoltman

07/25/2019, 12:32 PM
I can only speak for jvm and native, but yeah just a few lines of code
l

louiscad

07/26/2019, 8:22 AM
There's one already in Kotlin/Native
k

kpgalligan

07/26/2019, 1:03 PM
For common code
l

louiscad

07/26/2019, 10:10 PM
It seems JS doesn't support weak references natively, so you'll be able to create a common definition only if you don't support JS, or don't need weak reference on JS target.
k

kpgalligan

07/26/2019, 11:17 PM
Yeah, it’s an issue
3 Views