Re:Thoughts on Clojure UI framework
by tadfisher on Thursday September 09, 2021 @08:11PM
(#28476266)
Compose is still data-oriented! It's not only possible to pass a Button around, it's encouraged. The representation you should pass is a higher-order function, or lambda:
val button: @Composable () -> Unit = { Button(...) }
List(button) // definitely possible
The advantage is encapsulation: Button as a lambda exposes no external state, so you don't create tangled graphs of data dependencies in your UI.
You should definitely take another look at Compose, because this concept maps extremely well onto Lisps in general (code is data) and Clojure in particular (tight composition of immutable state).
Re:Thoughts on Clojure UI framework
by tonsky on Sunday September 12, 2021 @05:24PM
(#28505131)
I find encapsulation more of a disadvantage than advantage. I want access to internals when I need to. Passing lambdas is not data-oriented, and it does not help to prevent tangled data dependencies
You should definitely take another look at Compose, because this concept maps extremely well onto Lisps in general (code is data) and Clojure in particular (tight composition of immutable state).