Request for comments on exports

Please take a look at the Transparent term aliases thread, because the same applies to exports.

There are two different uses cases for the export keyword:

  • to define members “from a template” (to copy the declaration and add a forwarding),
  • to automatically import members from another object on a wildcard import.

In the first case, the definition should be opaque, in the second - transparent. However, currently export seems to imply opaque export. Although “forwarding exports” can seemingly also be used as “dual of imports”, this is an implementation detail, not the semantics, which is especially clear in IDEs.

It may be useful to formally distinguish between opaque exports and non-opaque export, in the same way Scala distinguishes between opaque types and non-opaque type aliases. (Another option is to consider transparent exports or inline exports.)

5 Likes