Say i have a Composable which, makes use of `stri...
# compose
Say i have a Composable which, makes use of
and maps from one object to another. I should be marking it as
? More in 🧵
Copy code
fun SomeSealedClass.toOtherSealedClass(): OtherSealedClass {
  return when (this) {
    is SomeSealedClass.Something -> OtherSealedClass.Something(label = stringResource(id = this.stringId))
Since this composable will never write to the composition, it can be marked as
IMO, to avoid generating groups and all.
As I recall, a Composable that returns a value should not have a group.
Functions that have a non-unit return value don’t get their own scopes because they can’t be re-executed without also re-executing their caller, so their caller can “see” the new return value computed by the function.
You never need to use these sorts of annotations. But yea if a composable returns a value then I don’t think this particular annotation has any effect anyway.
Ahh okay, but it will make compose runtime avoid generating groups and all on slot table? As it's not writing to a composition, generating things like those can be avoided, i believe.