Is inter-reference allowed while namespace initialization?


#1

one namespace:

package bar

val ff = 3
val we = foo.aa

another namespace:

package foo

val aa = bar.ff

Is this allowed? It is not working for JS backend and I am planning to fix related issue (namespaces initialization order is not determined), but I don’t know — is this should be supported?


#2

Namespace initialization order cannot be specifie, really. Unless you have a better idea, I'd go for Java-style behaviour: we can think of every kt file as a class, and its package-level declarations are static members.


#3

Java allows me to create such inter-references. So, kotlin js backend must support it. Thanks for clarification.