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

Taras Koshkin

07/27/2020, 10:24 PM
Do the
Preview
functions get stripped out during compile or does it just rely on r8/proguard to strip the unused code?
👀 1
l

Leland Richardson [G]

07/27/2020, 10:50 PM
right now I believe the answer is we rely on the code getting stripped w/ r8 and friends
🙏 1
i don’t really like this answer though, and long term I personally would like it if we moved away from previews defined in the same file as production code.
👍 4
but like most things, there are tradeoffs
z

Zach Klippenstein (he/him) [MOD]

07/27/2020, 10:52 PM
Might be cool if you could define preview functions in intellij scratch files. I think those already show computation results inline, so it would be really neat if the previews were rendered inline like that too, almost more like jupyter notebooks or something. I’m not sure how pluggable the “Scratch” feature is though
l

Leland Richardson [G]

07/27/2020, 10:55 PM
yeah i had a pretty big proposal that was along the same lines but would have been a lot more work to implement
t

Timo Drick

07/28/2020, 10:28 AM
in my tests after doing r8 optimization the tooling and preview functions getting stripped out. Not sure if this is still true for dev15
s

Stylianos Gakis

09/15/2021, 10:46 AM
Interesting to see @Leland Richardson [G] say this a year ago. It seems like this is not the way that
@Previews
are evolving right now even after 1.0 release. Is the idea of splitting them from the source file something of the past? Is it still discussed in any way?
l

Leland Richardson [G]

09/15/2021, 4:40 PM
my opinion/voice is just one of many, so the things i want to happen/change aren’t always what gets shipped (and of course i’m often missing some context). I would still like to see Preview change in this way, but i’m not sure it will in the near term. Please keep in mind that “even after 1.0 release” is just like saying “even after <super early in timeline of compose>“. 1.0 is just the beginning, and that is especially true when talking about developer tooling. There’s a lot of stuff in the air right now where we are trying to improve developer experience a lot, and Preview is a big part of that.
s

Stylianos Gakis

09/15/2021, 6:50 PM
Oh absolutely, when I mentioned the v1 release I meant that since by now there hasn't been any updates on it I simply assume that it's being pushed for later or still in discussions, not that what we see now is what we get forever obviously. I am glad to hear that it's still something in your mind, I am looking forward to see more updates about it when the time comes. Tooling definitely has a lot of impact on our day to day process, so I am happy to see it being prioritized!
👍 1