:mega: :mega: :mega: We have published v0.1 of Kot...
# announcements
i
📣 📣 📣 We have published v0.1 of Kotlin immutable collections library https://discuss.kotlinlang.org/t/kotlinx-collections-immutable-v0-1-has-been-published/2403/2
🎉 7
n
ilya.gorbunov: I'm just curious, what is insufficient about the current 'immutable' collections in the std library? I know you can just cast them to Mutable*, but other than that?
i
First, they are not immutable — just read-only
n
And second? I mean, the List interface is 'immutable' as long as you don't cast it right?
That's just a bit of discipline
i
No, it's not about casting. As long as you get
List
as a parameter, you can not reason about whether it's mutable or not. You know it's read-only, but that's all you know. So if you want it not to be changed from the outside, you have to make defensive copy.