Sylvain Patenaude
10/27/2021, 8:05 PMfreeze()
isn't part of the stdlib-common?
Would be useful in multiplatform common code.mbonnin
10/27/2021, 8:25 PMfreeze()
is a no-op on JVM/JS so I guess this is why. It's pretty easy to do your own version thoughSylvain Patenaude
10/27/2021, 8:58 PM@SharedImmutable
annotations on some `val`s in data
classes and enum
classes, but it seems it doesn't work anymore with kotlin >= 1.4. I needed those annotations for the iOS clients of my library as the data returned is transfering across other threads.
Is calling .freeze()
at a few strategic places the way to go or is there a more "standard" way to replace these @SharedImmutable
?mbonnin
10/27/2021, 9:03 PM@SharedImmutable
as top level properties instead of data classes properties.freeze()
in the "appropriate" place would work tooSylvain Patenaude
10/27/2021, 9:06 PM.freeze()
multiplatform implementation for now.
I don't understand why @SharedImmutable
doesn't work anymore though. It doesn't seem documented anywhere.