Does anyone know if there’s any plans yet for kotl...
# language-proposals
m
Does anyone know if there’s any plans yet for kotlin to introduce a type of value class (i know that keyword exists, but it’s for a single value inline class) that’s kind of like a data class, but without the backward compatibliity issues? Ideally it would follow the same rules (must have at least 1 val/var in the constructor, etc…) but generate only toString, equals and hashCode. And more importantly NOT generate the
copy
and destructuring functions which can cause backward compatibility issues in libraries. I was pointed to the https://github.com/drewhamilton/Poko library by someone, but i’m reluctant to use compiler plugins if i don’t have to, due to the current lack of a stable api which leads these plugins to have to adapter to the ever evolving plugin api.
s
Regarding value classes specifically, you can read https://github.com/Kotlin/KEEP/blob/master/notes/value-classes.md. There are plans for multi-field value classes, tentatively slated for preview in 1.9.0 I believe
k
or this https://github.com/AhmedMourad0/no-copy (yeah not that helpful based on your conditions)