Hey guys, Kotlin MPP doesn't work very well with r...
# multiplatform
l
Hey guys, Kotlin MPP doesn't work very well with reflection right now, right?
👌 2
s
Iirc JS support for reflection is very sparse, and native doesn’t support it at all
l
Do you know if there's any ETA on reflections? Or maybe a roadmap I can keep track of this?
s
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
I wanted to use reflection in a MPP lib, that's why
Is there any particular reason for why native wont support reflection?
e
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
I miss reflection support for retrofit and mocks
e
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
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
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
That's awesome!