www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Why constructs can not be private?

module A;

private struct A { }
private A a;
private mixin template magic() { }
private void foo() { }

//---------------------

module B;

import A;

void main() {
  A b;  // #1 works
  b = a; // #2 ERROR
  foo();  // #3 ERROR
}

struct B{

 mixin magic;  // #4 works
}


What's the point of declaring struct A private if it's not going to
behave as such?  is this another bug in DMD?  I want template mixin
magic to not be accessible outside module A.  Would that be possible?
Mar 06 2012