Allow `namespace.case` filter for `import`/`export`

A user can prefix definitions (def, val, lazy val, class, trait, object, enum) with the export keyword, e.g. export def bar = ???. […] then import foo.* will only import the export-ed definitions

I think this is an interesting possibility for the api-designer to help shaping the scope and provide a convenient, single line import, esp when experimenting in repl/worksheet etc.

But I see a problem of changing the semantics of wildcard import…

Perhaps the api-user could get the export-marked members via a new kind of import:

import foo.export

And maybe this feature could be combined with the implicit export of cases discussed here by treating companion object special in that export-marked companion object members are implicitly imported and has a companion as in import foo.export if foo is in scope or a target type. That would solve the enum inconvience.

2 Likes