! Compose developers: great, now let's wrap everything in
mutableStateOf
to make everything mutable again...
m
Mini
12/18/2022, 11:51 AM
Val has never been immutable
c
Chrimaeon
12/18/2022, 12:01 PM
val
never declared something immutable. The only thing it does is make the reference to the object not be changeable. You could always change the properties of the object.
https://kotlinlang.org/docs/basic-syntax.html#variables
y
yschimke
12/18/2022, 12:07 PM
Most systems need to deal with state changes. Unless you can express it as a purely functional algorithm. It's just better to have an immutable state value that changes, rather than a bunch of vars with no obvious coordination.
c
CLOVIS
12/18/2022, 2:49 PM
mutableStateOf
doesn't make things mutable. It allows collecting all the mutation events, and apply them all at once in a "parallel world" with a different state which is also immutable (as long as what you store is immutable, of course)
c
Colton Idle
12/20/2022, 7:42 AM
I think Adam powell said that snapshot state is technically immutable with mutable convenience methods on it or something like that.