digitalmars.D.bugs - [Issue 604] New: static, renamed, and selective imports aren't private
- d-bugmail puremagic.com (39/39) Nov 26 2006 http://d.puremagic.com/issues/show_bug.cgi?id=604
- d-bugmail puremagic.com (12/12) Jan 28 2007 http://d.puremagic.com/issues/show_bug.cgi?id=604
http://d.puremagic.com/issues/show_bug.cgi?id=604
Summary: static, renamed, and selective imports aren't private
Product: D
Version: 0.175
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: wbaxter gmail.com
The spec isn't specific about what should happen in this case, but I think the
behavior is not what one would expect and is undesirable.
Basic imports are now private by default, so import std.stdio in one file A
doesn't mean writefln will be accessible in file B that imports A. However if
you switch from "import std.stdio" to "import io = std.stdio" then B will be
able to access io.writefln. Similar situation with selective and static
imports. None of them act private, and sticking an extra 'private' in front of
the import statement doesn't change anything.
Here's an example:
-------- modulefoo.d -----------
module modulefoo;
static import std.string;
import stdio = std.stdio;
import std.stdio : writef;
--------- modulebar.d ------------
module modulebar;
import modulefoo;
void main()
{
stdio.writefln("This shouldn't work");
std.stdio.writefln("Don't think this should either");
stdio.writefln( std.string.format("This is odd too") );
writef( "This doesn't seem like it should work either\n");
}
--------------
"dmd -run modulebar" generates no errors at all.
--
Nov 26 2006
http://d.puremagic.com/issues/show_bug.cgi?id=604
torhu yahoo.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |torhu yahoo.com
Status|NEW |RESOLVED
Resolution| |DUPLICATE
Marked as dupliacate of issue 314
.http://d.puremagic.com/issues/show_bug.cgi?id=314
*** This bug has been marked as a duplicate of 314 ***
--
Jan 28 2007








d-bugmail puremagic.com