November 26, 2006 [Issue 604] New: static, renamed, and selective imports aren't private | ||||
---|---|---|---|---|
| ||||
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. -- |
January 29, 2007 [Issue 604] static, renamed, and selective imports aren't private | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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 ------- Comment #1 from torhu@yahoo.com 2007-01-29 01:56 ------- 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 *** -- |
Copyright © 1999-2021 by the D Language Foundation