Fabio Grumiro
06/10/2023, 9:07 PM@Stable
annotation since it seems that it doesn't affect skipping. Is it just useful for documentation purposes, or is it used by the compiler in some way?shikasd
06/10/2023, 10:16 PMeygraber
06/11/2023, 2:44 AMephemient
06/11/2023, 3:39 AM@Stable
on the function isn't usefulephemient
06/11/2023, 3:40 AM@Stable
indicates that it isFabio Grumiro
06/11/2023, 5:32 AM@Stable
are not skipped or memoized. Do you have an idea of how this stability would be used by Compose? What kind of benefits/optimizations can we expect?Arjan van Wieringen
06/11/2023, 6:15 AMeygraber
06/11/2023, 7:40 AMif the function parameters and result are all stable, then it is still not necessarily the case that the function is pure, but @Stable indicates that it is
So if the input and result are stable, but the function isn't marked
@Stable
does the compiler treat that result differently than if the function is marked @Stable
?shikasd
06/11/2023, 1:52 PMshikasd
06/11/2023, 2:02 PMStatic
(for constants) or Same
(e.g. values were compared before), it is assumed safe to propagate this state to the result of the stable function.eygraber
06/11/2023, 8:49 PMresult
would have a stability of `Unknown`:
@Immutable
object Foo
fun foo(param: Int) = Foo
@Composable
fun Foo() {
val result = foo(1)
Bar(result)
}
and in the following snippet it would be `Static`:
@Immutable
object Foo
@Stable
fun foo(param: Int) = Foo
@Composable
fun Foo() {
val result = foo(1)
Bar(result)
}
shikasd
06/11/2023, 9:02 PMUncertain
in the first case, but correct otherwise