4 ms·
> Is data changing that big of a problem? Yes, but it is hard to recognize it as such until you've experienced the alternative. I don't know much about Kotlin
by thedufer 9y ago
> Is data changing that big of a problem?
Yes, but it is hard to recognize it as such until you've experienced the alternative.
I don't know much about Kotlin, but the fact that it relies heavily on Java libraries is sufficient to tell me that it is a particularly poor example of the power of immutability. You see the usefulness of immutability when you have objects that are deeply immutable - when you pass them around, you know those functions haven't changed them. It is much easier to reason about deeply immutable objects than mutable ones.
> in immutable languages, are there cases where immutability extends to nonscalar values like arrays or hashes or objects
Yes, this is largely the point. Although, you will rarely see an immutable array or hashtable - more likely it will be a linked list or balanced binary search tree.
- tomc1985 9y agoYou're probably right, Kotlin's version of immutability is perhaps not the best example -- pretty sure the whole var/val thing is language sugar which explains why it doesn't work for nonscalars. Makes sense, I can see the appeal now. Thanks
- nine_k 9y agoKotlin runs on JVM but it's closer.to Scala, not Java. You can sure have immutable structures all the way down in it, as if it were Haskell. It doesn't enforce this style, though.