You are currently viewing Kotlin Concurrency and SharedImmutable

Kotlin Concurrency and SharedImmutable

Does this have any impact on non-native code?

Generally a const can not me mutable, an Array CAN be, unless it has a size of zero. data classes should be, but the rule is not tightly enforced. a List<T> is not mutable via the interface contract, but it CAN point to a Mutable List. The underlying MutableList can be modified

Array you can’t be sure of, i.e. DoubleArray can be say… sorted underneath, or reversed, UNLESS it is of size 0.

I have some zero size arrays, IntArray(0), etc, though they are technically immutable , there isn’t a contract to prove that. Seems like SharedImmutable would be a useful marker.

submitted by /u/Dean_S_Jones
[link] [comments]