Here are two suggestions for imports.

1) It would be really cool to be have named package imports:

import com.pkg.whatever as whatev
val x = whatev.somePackageLevelFunction()

You can already do that with objects, but sometimes you don’t want to group your function within objects and have to use import com.pkg.whatever.WrapperObject.* a lot internally. Especially since auto-completion does not kick in.

2) Extension methods could use some import-level support.

It’s not rare that I want to import all extensions to a type X from a certain package. But I can’t do that, you either import everything (import com.pkg.*) or you must import your extension methods one by one.

You could put all extensions methods in a separate package (and it’s really nice that you don’t need to put them in a separate folder!), but again, internally you’ll need to use import com.pkg.xextensions.* a lot).

It could look something like this:

import com.pkg.(X) // import all extension methods for X defined in `com.pkg`

"Extension types" for Kotlin

Aliases for packages

First paragraph look like very useful feature for developers how like write functional code.

For example, in big program clash on function signatures it’s very possible event.
In Clojure it solved by namespaces, but in Kotlin we has nothing (see below).


  • “Object/Component object” - restrice to hold all functions in one file and have bad syntax
  • Hack with annotaion (see code) - even more strage syntax and not supports on JS/Native
fun's ....

typealias f = Func

In my case it’s will be the best to write something like:

import as d
import as p

fun main (args: Array<String>) {

Maybe someone create proposal for KEEP?


I don’t have the time to write one right now, but if someone does, I’m willing to review it.


By the way Scala has package aliases:

import java.util.{concurrent => c}

val future = new c.CompletableFuture

If Kotlin wants to be best multi paradigm (FP) language, it’s +1 reason for aliases.


I agree that current mechanism where you can import function as with name change is pretty wired:/ and I would prefer import some package and name it

Currently it looks this way:

import func1.doSth as f1
import func2.doSth as f2

fun main(args: Array<String>) {

And when I am naming the function then I am doing it for reason. I don’t want anyone to use it with a different name. It is really confusing. In case of name conflict, I would prefer to prefix function with some name that will tell which function is that.


I think it’s already supported:

import java.math.BigInteger as BigInt

fun main(args: Array<String>) {
	val a = BigInt("233")
	println(a + BigInt("666"))

When you’re confronted with some problems, RTFM first :smile:


Named imports are possible for classes, not for packages.
Understand The Fucking Post first?


Well, I apologize for my carelessness.
And I don’t have any idea about named imports for packages. :joy:



In C# this is possible:

using Project = PC.MyCompany.Project;

This would be great for different packages that have simular class names.
It makes the code easier to read.