Now, what do you think about Compose?
# google-io
o
Now, what do you think about Compose?
k
Do you have a timestamp for that?
o
I couldn’t watch Dev Keynote due to bad timing, but I noticed TechCrunch article (doesn’t say much).
It looks like they're mixing xml and kotlin code?
e
They have not said much yet. It should be in Android talk (going now).
b
is this to solve state interaction with views like some kind of react dom solution?
e
But many people had already defected to Flutter talk.
They have a separate talk on Compose tomorrow at 15:30 on Stage 1 (Declarative UI patterns)
👍 2
b
r
Looks like React for Android, which is awesome 🎉.
e
It is way cooler than react and with mpp in mind. Come to the dedicated talk tomorrow.
🤩 8
▶️ 1
2
l
Do you think coroutines will play well with Compose @elizarov? I'm using them a lot in my UIs currently for many things like hiding views on cancellation, repeating stepped user flows, ticking timers, subscribing to state from a channel… I already do UIs with Kotlin on Android, no xml, but Compose seems very different from what I'm used to.
e
Compose is orthogonal to coroutines in a sense. Should play well at the end. It is just the beginning.
👍 1
l
BTW, someone in another Slack linked this comment line from Compose sources that shows being Android platform independent is already considered: https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-master-dev/ui/core/src/main/java/androidx/ui/painting/Canvas.kt#29 I dreamt about multiplatform Canvas for Kotlin, and it seems I'll be coming eventually, with the bonus of higher level building blocks too!
b
Finally all those state container libraries will be totally useful to android 😅
j
It seems state is built into those components like React Hooks. 🤩
m
@elizarov watched the talk, compose is looking very nice, are there plans to take it multiplatform?
e
Yes, multiplatform definitely it will be in the future. It’s Kotlin!
K 3
😱 1
🎉 6
l
I noticed the
@Compose
annotated functions don't return a value. Is it so it's allocation free?
g
What should it return? Each component draw on canvas as side effect, it's like call
Copy code
print("something")
e
They are like suspending functions. They carry hidden context with them, so they are not entirely like
println
— they emit into the tree in their context, not into some global “stdout”.
Thought — yes, worked out — no. For Google’s team working on Compose priority is getting this new UI toolkit into the hangs of Android devs. But the potential is big. Desktop UI is just one of many possible applications. You can use this approach and compiler plugin to emit dynamic DOM tree on JS, too. But there’s also a lot of work on JetBrains side — we need to finish unification of all Kotlin backends, so that one Kotlin IR plugin can work for all BEs.
👍 1
🙏 1
It is in the open now. You can browse the source. I doubt there’s any desktop stuff “in the works”, but I don’t see how it might avoid coming to desktop eventually. If not google, the somebody else ports it since it is simply would bee too easy and totally irresistable to do.
👍 1