Even better, perhaps some kind of concurrent map? ...
# kotlin-native
j
Even better, perhaps some kind of concurrent map? The cached results would be the same across threads, and could safely be frozen the moment they were computed.
o
There’s no concurrent map yet, however we consider implementing one. For now frozen
Array<AtomicReference>
can be used for such purpose
j
Cool, thanks!
h
Try this https://github.com/touchlab/Stately. It has
frozenHashMap()
j
Beautiful. Thank you @hmole.
k
I was going to suggest Stately. It does such things.
To be clear, I think over time we'll adjust how we think about architecture, but while we're sorting it out, having some atomically mutable state in frozen objects can be usable.
1