https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
l

LeoColman

05/02/2019, 4:08 PM
Hey guys, Kotlin MPP doesn't work very well with reflection right now, right?
👌 2
s

serebit

05/02/2019, 6:17 PM
Iirc JS support for reflection is very sparse, and native doesn’t support it at all
l

LeoColman

05/02/2019, 6:26 PM
Do you know if there's any ETA on reflections? Or maybe a roadmap I can keep track of this?
s

serebit

05/02/2019, 6:58 PM
Based on threads on the forum, it seems unlikely that K/N will support reflection in any meaningful way. Unless the team have changed their minds over the course of the last year and a half, I wouldn’t get your hopes up
If you require reflection facilities, I’d imagine @elizarov would still recommend sticking with K/JVM, as he did in Aug 2017
l

LeoColman

05/02/2019, 7:02 PM
I wanted to use reflection in a MPP lib, that's why
Is there any particular reason for why native wont support reflection?
e

elizarov

05/02/2019, 7:20 PM
Runtime size, binary size, optimizations. The reasons not to support reflection. What’s your use-case for reflection, tho? What are you trying to achieve?
t

thevery

05/02/2019, 11:23 PM
I miss reflection support for retrofit and mocks
e

elizarov

05/02/2019, 11:51 PM
Retrofit needs proxies. That’s very limited use-case. We plan to provide that in the future via a compiler plugin in multi-platform way, so that you will not need reflection for that.
👍 1
Mocks will take the same path (compiler plugin)
l

LeoColman

05/03/2019, 2:36 AM
What about things like KType?
I have to generate a factory based on a reified type specifications, but that's not very possible right now
e

elizarov

05/03/2019, 10:56 AM
Cross-platform KType is coming. You’ll have
typeOf<reified T>()
intrinsic function in stdlib that returns
KType
and works on all platforms.
🎉 3
l

LeoColman

05/03/2019, 7:07 PM
That's awesome!
13 Views