Bug 7830 – public import is not fully documented

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-05T07:02:00Z
Last change time
2012-12-02T17:31:07Z
Keywords
TDPL
Assigned to
nobody
Creator
schveiguy

Comments

Comment #0 by schveiguy — 2012-04-05T07:02:03Z
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