One thing that makes Swift is value semantics Are...
# getting-started
u
One thing that makes Swift is value semantics Are there any plans of adding this to the language? I presume real value types are a pipedream since jvm doesnt care, but the var semantics is way nicer code than
.copy
so maybe just the syntax as a sugar?
there is some hope for future JVMs, https://jdk.java.net/valhalla/ but it's not ready yet
u
soo nothing until valhalla?
realistically speaking
I'd gladly accept it just as a sugar for copy
btw do you have any info as on what big is coming next other than the new compiler? which sure is great for performance, but not really a language feature, is it
r
The main focus is on K2 right now, which will also bring some advantages language-wise. You can see what is being worked on in the roadmap: https://kotlinlang.org/docs/roadmap.html
e
to clarify, the Kotlin language is not changing with 2.0 (aside from minor fixes), only the Kotlin compiler implementation changing to K2
👍 2
https://blog.jetbrains.com/kotlin/2023/02/k2-kotlin-2-0/
We are consciously avoiding introducing any new features in Kotlin 2.0.
w
Kotlin's multi-field value classes do not strictly depend on Valhala. You can follow the progress in KT-1179.
I'd gladly accept it just as a sugar for copy
While there are no compiler plugins that get your desired semantics via
var
, there are some cool compiler plugins to make working with immutable data more pleasant. https://arrow-kt.io/learn/immutable-data/intro/