Jason5lee
08/27/2021, 6:33 AMa.b.c.d
and in another place I can import a.b.c.d
and reference them as `d.TypeName`/`d.function`. Is there a better way other than defining the inner d
as an object and put everything inside, which I’m not sure whether it is a good practice.Stephan Schroeder
08/30/2021, 6:40 AMd
is a package. If d
is a singleton/object, you'd retain your wish to write d.something()
object D {
fun something(): Unit {}
}
// or put it in the companion object of a normal class
class D {
companion object {
fun something(): Unit {}
}
}
In the future Kotlin will probably get namespaces, which will probably match what you ask for even more: