The current documentation for public import on the spec says only:
An import can be specifically declared public, when it will be treated as if any imports of the module with the ImportDeclaration also import the public imported modules.
This is not the full story. According TDPL, and the current implementation (all the way back to at least 2.033), a public import also aliases all symbols from the publicly imported module as if they were declared in the importing module.
for example:
submodule.d:
module submodule;
void foo() {}
pubimport.d:
module pubimport;
public import submodule;
main.d:
import pubimport;
void main()
{
pubimport.foo(); // Works!
}
The documentation should be amended with:
In addition, all symbols from the publicly imported module are aliased as if they were declared in the importing module.
The example should also be amended to demonstrate:
bar(); // ok, calls B.bar()
+ C.bar(); // ok, calls B.bar(), C aliases all of B's symbols
Comment #1 by github-bugzilla — 2012-12-02T17:30:26Z