www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10128] New: import statement in base class members should be private by default

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10128

           Summary: import statement in base class members should be
                    private by default
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com



From:
http://forum.dlang.org/post/CAFDvkcudf0S-DNHTPFHceBPVQj92vsErYuWTaPbC3Rd752ai9w mail.gmail.com

In module level, import declaration will add name lookup path _in private_.

module a;
import std.algorithm;   // default is private

module b;
import a;
void main() {
    [1,2,3].map!(a=>a);  // Error: no property 'map' for type 'int[]'
}

But with current master, import declaration in base class member adds name
lookup path _in public_.
I had not recognize this behavior.

class A {
    import std.algorithm;  // default is public!?
}
class B : A {
    void test() {
        auto r = [1,2,3].map!(a=>a);    // succeeds to compile
    }
}
void main() {
    auto r = B.map!(a=>a)([1,2,3]);    // also succeeds to compile
}

I think this is inconsistent, and class case should be fixed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 21 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10128


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/dmd/pull/2256

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