by bashor_ · 9y ago · 0 comments
JavaScript backend generates code understandable by static analyzers so it can be optimized. Anyway, we going to continue works in this area in near future.
> Kotlin for JS has no reflection, and I think JetBrains should not look into that as they said they are. But is there powerful compile-time code generation instead, e.g. through annotation processors?
Why do you think that reflection is a bad idea? Honestly, we don't have a final decision about it, it requires investigations and discussions. Note it's very important for us to have an ability to provide good tools (e.g IDE support) for features.
> Is there, or will there be, a healthy ecosystem of pure-Kotlin libraries that can be used with both the JVM and JS?
We will work on it.
OK, reflection isn't necessarily a bad idea. Clearly development tools need it, including future tools that run in the browser (e.g. an in-browser IDE). But I think that applications that are not development tools should not use reflection, because it interferes with static optimization, as the article that I linked in my original comment explains. So most libraries should probably not use reflection either. That means we need an alternative to reflection. For example, chapter 10 of _Kotlin in Action_ uses reflection to implement a serialization library. I think it would be better to use build-time code generation for that, even outside the JS use case (e.g. reflection interfers with optimization of Android app packages with ProGuard).
Edit: By the way, thanks for taking the time to respond.