Why constructs can not be private?

Caligo iteronvexor at gmail.com
Tue Mar 6 20:24:55 PST 2012


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?


More information about the Digitalmars-d-learn mailing list