'private import' and 'private alias' is not working.

CLXX kk_tnr at hotmail.com
Thu Feb 26 09:10:54 PST 2009


I found some private attributes is not working.
DMD 2.025 Windows

//aaa.d
private static import std.string;
private alias std.string.find find;
private import std.conv: to;

// main.d
import aaa;
void main( ){
  string x = "main.d";
  find( x, "." ); // should be ERROR!
  std.string.ifind( x, "." ); // sould be ERROR?
  to!( wstring )( x ); // sould be ERROR?
}

First, 'find' in 'main.d' should not be accessible because 'alias' has 'private' attribute.
Second 'std.string.ifind' should not be accessible I think, because 'std.string' in 'aaa.d' is imported privately.
Third, 'to' in 'main.d' should not be accessible I think, because 'std.conv' is imported privately.

If we want to use 'std.string.ifind' in 'main.d', we can import 'std.string' in 'main.d'.
And the same, in order to use 'to' in 'main.d', we should import 'std.conv: to'.

Less symbols we can see, more easily we can get.


More information about the Digitalmars-d-bugs mailing list