Manuel Dossinger
09/13/2021, 1:11 PMdata class MutableClass(var my1, var my2, var my3...)
and a fitting data class ImmutableClass(val my1, val my2, val my3...)
. So the only difference is, that all members of one class are var
and the members of the other one are val
and of course I don't want to write the list of members twice 🙂Joffrey
09/13/2021, 1:41 PMvar
to val
in some way via a language feature wouldn't guarantee immutability (it would depend on the implementation of the class itself)edrd
09/13/2021, 1:48 PMManuel Dossinger
09/13/2021, 1:59 PMPaul Griffith
09/13/2021, 4:24 PMJoffrey
09/13/2021, 5:38 PM