www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7830] New: public import is not fully documented

reply d-bugmail puremagic.com writes:
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



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: -------
Apr 05 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7830




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


[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: -------
Dec 02 2012
prev sibling parent d-bugmail puremagic.com writes:
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: -------
Dec 02 2012