dimsuz
05/31/2021, 12:58 PM@Stable
imply @Immutable
or vice versa?
2. If I have a data class
which contains only vals (which are either other data classes or privitives or non-mutable collection types), does it mean that Compose compiler plugin will be able to infer `@Stable`/`@Immutable` automatically? I found an earlier thread that seemed to suggest that.
3. It would be great if both of these points were somehow covered in documentation (or did I miss that?)Adam Powell
05/31/2021, 1:52 PMAdam Powell
05/31/2021, 1:53 PMAdam Powell
05/31/2021, 1:56 PMeygraber
05/31/2021, 2:26 PMAdam Powell
05/31/2021, 2:30 PMby mutableStateOf
properties. It can change, but it's always equal to itself and notifies compose of those changes when they happen. Similarly, a type that points at the same stable objects and compares as equal if the objects it points to are reference equaldimsuz
05/31/2021, 2:44 PMList<T>
, Map<T>
or other effectively immutable data structure I should explicitly mark this class as Immutable, otherwise I can rely on compose smartness 🙂Adam Powell
05/31/2021, 3:06 PM@Stable
and @Immutable
make a promise to compose that it can't verify without knowing the semantic things you know about your code. You can declare a type @Immutable
that contains a List<T>
, but if you assign a mutableListOf
to that property and start changing it you're going to have a bad timedimsuz
05/31/2021, 3:45 PM