Typealias for "packages"

Hi everyone,

In a situation where I have multiple naming conflicts and I might need to add multiple typealias / import alias (import … as Alias), I was wondering if there is a way to create an alias to a package, like typealias or import alias…

For examples, we could simplify the following code:

import com.example.ViewModel as ExampleViewModel
Import com.example.Navigator as ExampleNavigator

import com.simple.ViewModel as SimpleViewModel
Import com.simple.Navigator as SimpleNavigator

By something like that:

typealias Example = com.example
typealias Simple = com.simple

// Another File on root package
import Example
// or maybe something similar to this:
import com.simple as Simple

val viewModel = Example.ViewModel()
val navigator = Simple.Navigator()

The code presented here doesn’t work. Does Kotlin support something similar? :thinking:

Does Kotlin support something similar?

No, but it looks reasonable. Please file a feature request at http://kotl.in/issue with your use case. Thanks!