Thread
#language-evolution
    c

    CraftSpider

    2 years ago
    Hello. I have interest in K/N reflection. If I were interested in doing work to add support for it, what would be involved in that? Is it currently blocked by technical limitations, or would this kind of thing be practical?
    r

    r4zzz4k

    2 years ago
    Are you sure you really need runtime reflection? If you are okay with compile-time introspection, you should be able to do it with compiler plugins API, in a same way kotlinx.serialization is implemented, for example. API is neither stable nor documented at this point, but it should still be much easier to consume than adding any kind on reflection to K/N (I believe language team isn't really willing to support full-blown reflection there).
    c

    CraftSpider

    2 years ago
    To do it compile-time would require significant changes to my intended use, as it relies on passing the types around at runtime / generics, and I was hoping to use it in a multiplatform context. Also, when I saw reflection wasn't supported, I figured it would be worth looking into adding it to the language, for increased platform parity. Is language team uninterested for specific reasons? EG increased binary size, difficulty to support, etc
    Actually, I could possibly implement full reflection as a compiler plugin, and if it works, look to simply promote that as an option. It would basically be the same as full reflection, plus the work to make it handle accesses on KClass correctly, treating them as basically built-in extensions