elizarov
07/01/2020, 2:34 PMdave08
07/01/2020, 3:39 PMapplicationWindow.apply { // this: ApplicationWindow
title = "Just an example"
position = FramePosition.AUTO
content = createContent()
}.show()
where the initialization and instantiation is seperate?elizarov
07/01/2020, 5:33 PMJoost Klitsie
07/02/2020, 8:00 AMsomething.apply {...}.also {...}
to separate initialization and actual usage (where necessary of course), so happy to see other people thinking the samemikehearn
07/02/2020, 10:55 AMelizarov
07/02/2020, 10:58 AMelizarov
07/02/2020, 11:03 AMelizarov
07/02/2020, 11:10 AMmikehearn
07/02/2020, 2:34 PMelizarov
07/02/2020, 3:05 PMRobert Jaros
07/02/2020, 3:45 PMRobert Jaros
07/02/2020, 3:47 PMelizarov
07/02/2020, 3:55 PMRobert Jaros
07/02/2020, 4:04 PMelizarov
07/02/2020, 4:31 PMelizarov
07/02/2020, 4:33 PMLeland Richardson [G]
07/02/2020, 4:35 PMcuz for sure in all those frameworks those objects existKind of. In Compose we end up targeting a mutable hierarchy of nodes we call “ComponentNodes”. These are not part of public API though, and are very primitive in scope. They have little more than a draw lambda, a layout lambda, and some children associated with them. When you render a “Button” in compose for instance, the declaration and configuration of that button is much higher level and what componentnodes it ends up creating are very much an implementation detail. Additionally, Compose’s runtime is built on top of a “Composer” object that manages a lot of what is happening. The composer is built in such a way that it can target both mutable tree types as well as immutable tree types (for instance a tree utilizing a shared persistent data structure). Of course, to be clear, Mutable/Immutable is not the same as Imperative/Declarative. And none of this is completely black and white, it’s a spectrum. Compose’s programming model pushes you in a declarative direction and part of that is when you want to change what UI is displayed on screen, you should think of it as data/state changing and then re-running a function that maps that data onto a UI. UI elements are configured by the inputs you pass into them, and not as a reference of some thing you pass around. This ends up having a lot of downstream effects in terms of reducing coupling and allows you to very easily refactor or delete parts of your UI. One might argue this feels like a hack if you are building on top of a UI framework that wasn’t meant for this (ie, DOM Elements on the web), but when the UI toolkit was built with this paradigm from the ground up, I would argue there is no longer this sort of “impedance mismatch”
elizarov
07/02/2020, 4:36 PMRobert Jaros
07/02/2020, 5:38 PMelizarov
07/02/2020, 5:50 PMelizarov
07/02/2020, 5:57 PMRobert Jaros
07/02/2020, 5:58 PMelizarov
07/02/2020, 6:19 PMmikehearn
07/03/2020, 8:24 AMmikehearn
07/03/2020, 8:31 AMmikehearn
07/03/2020, 8:32 AMmikehearn
07/03/2020, 9:21 AMelizarov
07/03/2020, 9:31 AMelizarov
07/03/2020, 9:46 AMmikehearn
07/03/2020, 10:06 AMelizarov
07/03/2020, 10:41 AMolonho
07/03/2020, 2:30 PMRobert Jaros
07/03/2020, 4:58 PMLeland Richardson [G]
07/03/2020, 5:22 PMmikehearn
07/04/2020, 12:18 PMmikehearn
07/08/2020, 11:07 AM