Are there any plans to add module import declarati...
# language-evolution
j
Are there any plans to add module import declarations to Kotlin similar to Java 23? https://openjdk.org/jeps/476 It would be very useful to import an entire module along with all of its declarations. The need is definitely there currently, as for example Ktor literally has an IDE plugin auto-importing the relevant classes to make using it easier. It would be better to just import the entire module instead, which would work for not only Ktor but also any other APIs designed by other developers.
👍 2
m
We don’t plan to introduce module-level imports in Kotlin. Instead, we’re exploring ways how to import extensions easier — either for a specific type or package. Normally, it's not a problem to find a type; IDE works fine in this case. The actual problem typically happens with extensions that are designed to be used together but imported separately. That’s where we want to help the IDE by introducing a new form of "extension imports". Module imports and
*
-imports can easily pollute the scope with unrelated types and top-level functions without a receiver, which I believe will bring more problems than benefits. Plus, to use module-imports, your library has to be designed in such a way. Which means that most application code, most likely, won't benefit from it