Zach Klippenstein (he/him) [MOD]
07/28/2020, 9:23 PMsavedInstanceState? Looks like it’s stuck around for now?Leland Richardson [G]
07/28/2020, 9:33 PMLeland Richardson [G]
07/28/2020, 9:34 PMstate : savedInstanceState :: remember : rememberSavedInstanceStateLeland Richardson [G]
07/28/2020, 9:34 PMrememberSavedInstanceStateLeland Richardson [G]
07/28/2020, 9:34 PMLeland Richardson [G]
07/28/2020, 9:34 PMrememberSavedInstanceState { mutableStateOf(0) } would get an autosaver that would “just work”brandonmcansh
07/28/2020, 9:37 PMZach Klippenstein (he/him) [MOD]
07/28/2020, 9:39 PMrememberSavedInstanceState is a little weird to me conceptually. Why would I care about saving an immutable value? The kdoc explanation about mutable values makes more sense, but for rememberSavedInstanceState { mutableStateOf(0) }, you’d need to always wrap your custom Saver in one that unwraps/wraps the MutableState value, right? That’s a bit awkward.Zach Klippenstein (he/him) [MOD]
07/28/2020, 9:40 PMState or MutableState, and automatically wraps the Saver would solve that.Zach Klippenstein (he/him) [MOD]
07/28/2020, 9:41 PMstate seems so common and small that I’m a little disappointed to see it go away, although I completely understand the desire to minimize the amount of magic and the API surface, and this is probably a lot simpler to educate.Leland Richardson [G]
07/28/2020, 9:46 PMstate API so strongly that you’d have to pry it from my cold dead fingersLeland Richardson [G]
07/28/2020, 9:46 PMLeland Richardson [G]
07/28/2020, 9:46 PMstate API actually isLeland Richardson [G]
07/28/2020, 9:47 PMremember is the real fundamental API that people need to understandLeland Richardson [G]
07/28/2020, 9:47 PMremember, they might miss the fact that state is just a convenient call to rememberLeland Richardson [G]
07/28/2020, 9:48 PMLeland Richardson [G]
07/28/2020, 9:48 PMmutableStateOf can be used outside of compositionLeland Richardson [G]
07/28/2020, 9:49 PMZach Klippenstein (he/him) [MOD]
07/28/2020, 9:49 PMLeland Richardson [G]
07/28/2020, 9:49 PM@Composable fun SomeClass() = remember { SomeClass(SomeAmbient.current) }Leland Richardson [G]
07/28/2020, 9:50 PMLeland Richardson [G]
07/28/2020, 9:50 PMremember to hammer in the pointLeland Richardson [G]
07/28/2020, 9:50 PM@Composable fun rememberSomeClass() = …Leland Richardson [G]
07/28/2020, 9:51 PMLeland Richardson [G]
07/28/2020, 9:51 PM@Composable fun SomeClass() = SomeClass(SomeAmbient.current)Leland Richardson [G]
07/28/2020, 9:52 PMLeland Richardson [G]
07/28/2020, 9:52 PMZach Klippenstein (he/him) [MOD]
07/28/2020, 9:55 PMLeland Richardson [G]
07/28/2020, 9:55 PMLeland Richardson [G]
07/28/2020, 9:56 PMLeland Richardson [G]
07/28/2020, 9:56 PMTimo Drick
07/28/2020, 10:14 PMTimo Drick
07/28/2020, 10:17 PMLeland Richardson [G]
07/28/2020, 10:40 PMLeland Richardson [G]
07/28/2020, 10:41 PMlazy is the right term to use here. i’m actually quite happy with the name of remember but maybe others feel differently?Timo Drick
07/28/2020, 11:40 PMbrandonmcansh
07/29/2020, 12:01 AMZach Klippenstein (he/him) [MOD]
07/29/2020, 12:09 AMremember initializes the value (invokes the lambda) eagerly/synchronously. The lazy delegate doesn’t initialize the value until it’s read (i.e., lazily). Like the lazy delegate, Lazy*Items doesn’t add its children to the composition until they’re scrolled into view.Timo Drick
07/29/2020, 12:12 AMbrandonmcansh
07/29/2020, 12:19 AMandylamax
07/29/2020, 1:36 AMLazy*Items has been bugging me so much. @Zach Klippenstein (he/him) [MOD]'s explanation has made it so clear to me. ThanksZach Klippenstein (he/him) [MOD]
07/29/2020, 1:38 AMRecyclerView is such a weird name, when you think about it – the main feature of RecyclerView is that it’s lazy. The fact that it recycles views is just an optimization to reduce memory usage and allocations. It doesn’t have anything to do with its core functionality. I like the Lazy*Items name a lot better, since it highlights the main feature/use case.Leland Richardson [G]
07/29/2020, 1:54 AMZach Klippenstein (he/him) [MOD]
07/29/2020, 1:58 AMhttps://media.giphy.com/media/jUwpNzg9IcyrK/giphy.gif▾
Leland Richardson [G]
07/29/2020, 1:59 AMandylamax
07/29/2020, 2:00 AMgildor
07/29/2020, 2:54 AMstate{} function to get rid of boilerplateZach Klippenstein (he/him) [MOD]
07/29/2020, 3:13 AMgildor
07/29/2020, 3:16 AMremember { mutableStateOf(…) } , alt + enter, extract to a function and forget about it next minute (or maybe it will remember only one developer in the project who introduced this extension)gildor
07/29/2020, 3:17 AMrememberState { … } would be probably betterLeland Richardson [G]
07/29/2020, 4:27 AMrememberStateLeland Richardson [G]
07/29/2020, 4:28 AMLeland Richardson [G]
07/29/2020, 4:28 AMLeland Richardson [G]
07/29/2020, 4:29 AMLeland Richardson [G]
07/29/2020, 4:29 AMLeland Richardson [G]
07/29/2020, 4:29 AMremember and mutableStateOfgildor
07/29/2020, 5:44 AMmuch harder for us to remove an APIMaybe use OptIn annotation, same as Kotlin stdlib does
andylamax
07/29/2020, 5:45 AMgildor
07/29/2020, 5:47 AM