Module compilation unit grammar
mark.reinhold at oracle.com
mark.reinhold at oracle.com
Fri Apr 1 20:40:54 PDT 2011
2011/4/1 16:22 -0700, alex.buckley at oracle.com:
> There are two ways to define export:
> 1) Export a package as a unit. No need for '.*' and it is impossible to export
> individual types. (Allowing 'export p.q' to mean package p.q but 'export p.q.r'
> to mean type r in package p.q is too confusing, I think.)
>
> 2) Export individual types, and use '.*' to export all public types in the
> package. Also '.**' to export all public types in subpackages.
>
> I prefer (2) because:
>
> - While it's appealing to think of a package as a unit, the reality is that a
> package is nothing more than a qualifier on a type name. A module system
> doesn't make a package visible per se; it makes certain public types in a
> package visible.
>
> - 'import' already provides a type-centric view of the world. Even if you write
> 'import foo.*', you are aware of individual types within package foo. I think
> we should stick with it for 'export'. Good practice may end up being to export
> individual type names, as it is with import.
>
> - It allows the .** "all subpackages" export, which (1) would enumerate
> individually.
That seems exactly right to me.
- Mark
More information about the jigsaw-dev
mailing list