(no title)
tmail21 | 8 years ago
My understanding is that Swift has these to some extent ("let" vs "var", structs being immutable etc). And since Kotlin is built on JVM compatibility I _assume_ that Kotlin does not support an immutable style of programming. Maybe someone here has more clarity on this.
problems|8 years ago
The underlying host doesn't imply anything about language support as that's handled at the compiler level, not at the machine or VM level.
Even in Haskell data isn't immutable if you have a debugger or modify the machine code. It's simply a tool provided and enforced solely by the compiler - other JVM languages do support it like Clojure or Scala.
jnbiche|8 years ago
Both Clojure and Scala that run on JVM have strong support for immutability, so it's quite possible on the JVM.
And yes, Swift has let binding, and other features to support immutability.
jorgemf|8 years ago
And for structures you have list, mutablelist, map, mutablemap, etc.
What else do you want?
tmail21|8 years ago
According to this http://stackoverflow.com/questions/33727657/kotlin-and-immut... Kotlin does not support true immutability.
For immutability to be practical one would need to implement structural sharing in their collections otherwise copying would be prohibitively expensive.
This Java library seems to be trying to implement this. http://www.vavr.io/
Again, I am not saying that Kotlin does not support immutability, just trying to get to the bottom of the reality of it.