https://kotlinlang.org logo
#compose
Title
# compose
s

streetsofboston

05/21/2019, 11:42 AM
Yes, they return Unit, but the Compose annotation is hooked up to a compiler plugin and this causes some magic in generating a model/hierarchy of the views (that is what I understood from my unit-testing question here: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1557666472013700?thread_ts=1557666472.013700&cid=CJLTWPH7S )
m

miha-x64

05/21/2019, 11:58 AM
soooooo crappy creepy
m

mbonnin

05/21/2019, 12:07 PM
"Any sufficiently advanced technology is indistinguishable from magic"
m

miha-x64

05/21/2019, 12:10 PM
Any codegen and reflection is indistinguishable from legacy-code.
1
1
m

mbonnin

05/21/2019, 12:19 PM
I believe that codegen and more intelligent compilers can actually make programming less repetitive. Reflection is mostly bad as it breaks compile time type safety.
m

miha-x64

05/21/2019, 1:05 PM
Programming can be less repetitive without reflection/codegen. But this requires more intelligent programmers...
m

mbonnin

05/21/2019, 1:16 PM
It's just a matter of what tools programmers learn. If you learn
@JsonClass(generateAdapter = true)
, you will never need to know how to write a custom json serializer. Maybe it's a bad thing, maybe not. But then who knows how to write assembly these days...
s

streetsofboston

05/21/2019, 1:25 PM
But I thank all gods in heaven for abstractions and i’m willing to call a plumber or deal with the occasional leaks myself on occasion …. 🙂 I can’t imagine drawing all pixels myself, making sure that ordering UDP packages are in order and reliable (most of the time), dealing with garbage collection, etc. I think a lot of abstractions are good trade-offs (and some are not)
3
n

napperley

05/21/2019, 9:29 PM
Is the use of annotations in Compose a good trade off considering there is a lot of magic involved with them (also increases build time)? Were other methods explored which don't require the use of annotations/meta-programming?
m

miha-x64

05/22/2019, 9:20 AM
Of course it is a bad trade-off. Of course there are other methods.
r

Ryan Mentley

05/22/2019, 7:31 PM
The annotation is just a signal to the compiler. Compose isn't an annotation processor, so you won't have the drawbacks you're used to with annotation processors.
m

mbonnin

05/22/2019, 9:12 PM
@Ryan Mentley I'm curious why it doesn't use a keyword (like
suspend
for coroutines) by the way. That would hint at compiler support more. Or maybe plugins cannot add keywords ?
r

Ryan Mentley

05/22/2019, 10:18 PM
@mbonnin You're exactly correct - plugins cannot add keywords. There's some discussion toward the end of this thread between Leland and Roman: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1558440714121300
👍 1
4 Views