'public' import ('export')

Right now all the imports aren’t visible outside of the importing scope.

Though it would be great if we may opt-in for imports visible from outside:

package my.pkg1

public import my.pkg2.Symbol

and/or

class MyClass {
   public import MyClass._
}   

object MyClass {
  case class MyModelDef()
}

So, now Symbol should be importable from pkg1 and MyModelDef should be importable from MyClass. This would allow to significantly reduce amount of boilerplate imports for those who are trying to hide implementation details from top level.

It should be relatively easy to support this, we may just generate type aliases for all the public imports.

Also and we don’t need to introduce new keywords.

This is related to: Pre-SIP: export, dual* of import , but should be easier to implement

1 Like