www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - 'private import' and 'private alias' is not working.

reply CLXX <kk_tnr hotmail.com> writes:
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.
Feb 26 2009
parent reply Christopher Wright <dhasenan gmail.com> writes:
CLXX wrote:
 I found some private attributes is not working.

Private imports work if you just do "private import foo;". They fail if the import is also static. They fail if the import is renamed. They fail if the import is selective. There is a bugzilla entry for this somewhere.
Feb 26 2009
next sibling parent CLXX <kk_tnr hotmail.com> writes:
 There is a bugzilla entry for this somewhere.

Thank you for your reply. I'm surprised to see so early.
Feb 27 2009
prev sibling parent Gide Nwawudu <gide btinternet.com> writes:
On Thu, 26 Feb 2009 18:05:46 -0500, Christopher Wright
<dhasenan gmail.com> wrote:

CLXX wrote:
 I found some private attributes is not working.

Private imports work if you just do "private import foo;". They fail if the import is also static. They fail if the import is renamed. They fail if the import is selective. There is a bugzilla entry for this somewhere.

http://d.puremagic.com/issues/show_bug.cgi?id=314 Gide
Feb 27 2009