<@U3SK5B492> Is any sort of weak reference, or wea...
# kotlin-native
s
@olonho Is any sort of weak reference, or weakmap planned for kotlin-native?
s
Hooray! Thanks 🙂
j
Awesome! Was hoping that was the case. Nice work!
d
Out of curiosity, why is the upper bound on
T
nullable? Does it make any sense to have a weak reference to a nullable type? It stood out to me because of the null check in the constructor... can it not be enforced by the type system?
👍 1
j
I think it has something to do with offering support to both C Pointer reference types and Kotlin objects. See the WeakPrivate.kt file in the same directory.
o
That’s probably just an oversight on my side, T better be bound by
Any
indeed
Btw, current weak refs are only work to Kotlin objects, not to Objective-C ones. However, we plan to improve on that soon.