www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Possible private alias error?

The following test code below is here just for testing for a possible error. Am
I missing something here, but shouldn't a "private alias" defined in one module
cause an error if it's called in another module that doesn't re-define it?

# Privately defined alias done here.
# module printstr;
# private import std.stdio;
#
# private alias .std.stdio ss;
#
# void printstring(in char[] s)
# {
#     ss.writefln("printstring(\"%s\")=\"%s\"", s, s);
# } 

# //--------------------------------------------------------------

# // ss is not defined but used, shouldn't it fail?
# module testalias;
#
# private import std.stdio;
# private import std.string;
# private import printstr;
#
# int main()
# {
#     char[] s = "TEST STRING";
#     // ss is defined as a private alias in printstr,
#     // but it still works here?!? Should it?
#     ss.writefln("tolower(\"%s\")=\"%s\"", s, tolower(s));
#     printstring(s);
#    
#     return 0;
# }

Output:
-------
C:\dmd>dmd testalias.d printstring.d
C:\dmd\bin\..\..\dm\bin\link.exe testalias+printstring,,,user32+kernel32/noi;

C:\dmd>testalias
tolower("TEST STRING")="test string"
printstring("TEST STRING")="TEST STRING"

C:\dmd>

Thanks in advance for any insight,
David L.

-------------------------------------------------------------------
"Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
-------------------------------------------------------------------

MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
Jun 13 2005