Join Slack
Is there still no multiplatform WeakReference?
# getting-started
c
CLOVIS
06/05/2023, 8:08 PM
Is there still no multiplatform WeakReference?
e
ephemient
06/05/2023, 8:14 PM
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native.ref/-weak-reference/
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef
ephemient
06/05/2023, 8:21 PM
hmm the APIs aren't really that close; there doesn't seem to be a way to
.clear()
in JS. maybe you could fake it with a `FinalizationRegistry`/`WeakMap` and some wrappers
c
CLOVIS
06/05/2023, 8:33 PM
I just need a
get
operation that returns
null
if the object has been cleared so I can avoid a strong reference
CLOVIS
06/05/2023, 8:34 PM
…I might create a micro-library for that
e
ephemient
06/05/2023, 8:35 PM
hmm I don't think there's a WeakRef for wasm-gc
373
Views
Open in Slack
Previous
Next
kotlinlang
A modern programming language that makes developers happier.
Powered by