Hiding types

Philippe Sigaud via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 30 12:50:41 PDT 2014


I'm trying to 'hide' a type, so as not to see it outside its 
module. I want to control the way it's created and used.

I know of Voldemort types and '@disable this', but for now I'm 
just trying to use 'private'. Halas, it seems it can be 
circumvented:

*********

module A;

private struct Hidden {}

Hidden foo() { return Hidden();}

*********

module B;

import A;

void main() {
     typeof(foo()) h;
}

*********

Am I misunderstanding something or is that a bug?


More information about the Digitalmars-d-learn mailing list