Thread overview
[Issue 7830] New: public import is not fully documented
April 05, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7830

           Summary: public import is not fully documented
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: TDPL
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody@puremagic.com
        ReportedBy: schveiguy@yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy@yahoo.com> 2012-04-05 07:02:03 PDT ---
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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 03, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7830



--- Comment #1 from github-bugzilla@puremagic.com 2012-12-02 17:30:26 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/d-programming-language.org

https://github.com/D-Programming-Language/d-programming-language.org/commit/057620c62fe795d1160c17dee878ba2ad6e61291 Fixes Issue 7830 - Document public imports better.

https://github.com/D-Programming-Language/d-programming-language.org/commit/fb2c7f58ee771828e1794016bc3c6db204fab5e8 Merge pull request #205 from AndrejMitrovic/Fix7830

[spec, triv] Issue 7830 - Document public imports better

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 03, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7830


Alex Rønne Petersen <alex@lycus.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |alex@lycus.org
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------