www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 313] New: Fully qualified names bypass private imports

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

           Summary: Fully qualified names bypass private imports
           Product: D
           Version: 0.165
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: deewiant gmail.com


In file a.d:
--
// explicit private no longer needed but added for clarity
private import std.stdio;
--
In file b.d:
--
import a;

void main() {
        // compiler correctly reports "undefined identifier writefln"
        writefln("foo");
        // works fine!
        std.stdio.writefln("foo");
}


-- 
Aug 27 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-08-27:
 http://d.puremagic.com/issues/show_bug.cgi?id=313

 In file a.d:
 --
 // explicit private no longer needed but added for clarity
 private import std.stdio;
 --
 In file b.d:
 --
 import a;

 void main() {
         // compiler correctly reports "undefined identifier writefln"
         writefln("foo");
         // works fine!
         std.stdio.writefln("foo");
 }

Added to DStress as ( http://dstress.kuehne.cn/addon/import_16_A.d ) ( http://dstress.kuehne.cn/addon/import_16_B.d ) http://dstress.kuehne.cn/nocompile/i/import_16_C.d http://dstress.kuehne.cn/nocompile/i/import_16_D.d http://dstress.kuehne.cn/nocompile/i/import_16_E.d http://dstress.kuehne.cn/nocompile/i/import_16_F.d http://dstress.kuehne.cn/nocompile/i/import_16_G.d http://dstress.kuehne.cn/nocompile/i/import_16_H.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFCI/kLK5blCcjpWoRAr2vAJ9kMpOBRbvfc+shCaY5sUmJ2A0mHgCgiqwL gXiXz3j5CfhZNxSD/od/FP4= =t6HB -----END PGP SIGNATURE-----
Sep 13 2006
prev sibling next sibling parent reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


davidl 126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from davidl 126.com  2007-01-23 04:25 -------
d 1.0 does correctly report the error message


-- 
Jan 23 2007
parent Derek Parnell <derek psych.ward> writes:
On Tue, 23 Jan 2007 10:25:56 +0000 (UTC), d-bugmail puremagic.com wrote:

 http://d.puremagic.com/issues/show_bug.cgi?id=313
 
 
 davidl 126.com changed:
 
            What    |Removed                     |Added
 ----------------------------------------------------------------------------
              Status|NEW                         |RESOLVED
          Resolution|                            |FIXED
 
 
 
 
 ------- Comment #2 from davidl 126.com  2007-01-23 04:25 -------
 d 1.0 does correctly report the error message

But is it correct? If the 'std.stdio' is private to "a.d" and not explicitly imported in to "b.d", then a statement in "b.d" should not be able to use anything in std.stdio, fully qualified or not. As far as I'm concerned, D is still broken in this regard as it allows one to get access to private identifiers just by fully qualifying them. I believe that private identifies are *private* and thus should not be be able to be accessed by another module. -- Derek Parnell
Jan 23 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |




------- Comment #3 from thomas-dloop kuehne.cn  2007-01-23 07:44 -------
David, did you test on Windows?

import_16_C, D, F - H still fail on Linux.


-- 
Jan 23 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tomas famolsen.dk




------- Comment #4 from thomas-dloop kuehne.cn  2007-01-24 02:09 -------
*** Bug 880 has been marked as a duplicate of this bug. ***


-- 
Jan 24 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=313





------- Comment #5 from bugzilla digitalmars.com  2008-12-08 00:52 -------
Although this particular bug is fixed as of dmd 1.037 and 2.021, there are
other cases that fail.


-- 
Dec 07 2008