Recursive import statement

This was brought up in the Kara group last week. The problem is that, for a large-ish framework like Kara, the code is broken up into dozens of packages. For any given file in a project that uses Kara, you may need to import 5-10 of these packages. For the most part, the IDE will do a good job of telling which ones are needed, but there are some cases where it won't (like extension operator overloads).

The suggestion was to simply flatten the Kara package hierarchy into one package that you can import into every file and be done. While this would make life easier for the end-user, it seems like it would make it more difficult to maintain the framework and would also break the folder-based package naming assumption.

It seems like a good middle ground would be to add a recursive import statement into Kotlin, such that the end-user can specify something like:

import kara..

and the compiler would know to import all packages starting with ‘kara.’. So my question is: does this seem like a reasonable request or a difficult one to implement? Are there any hidden gotchas for an implementation like this (other than the obvious need to ensure there are no class/function naming collisions in all of the child packages)?

Looks like this will be a performance problem.

We will soon support default imports for modules: a module will be able to declare which imports go into every file by default, this will solve the problem.

Okay, cool. This sounds like a good solution. Is something that's declared in the IDE's module settings, or is there a way specify it directly in code?

There's a notion of a module script (a Kotlin source file that descrbes a modules). It is currently generated by the IDE on the fly (from the IDE module structure), but it could be a persistent artifact too.