private module declarations

Oskar Linde oskar.lindeREM at OVEgmail.com
Tue Aug 8 08:09:45 PDT 2006


Tom wrote:
> I know this is not the first time this comes into the light but... I 
> insist.
> 
> Actually (luckily), one can do the following:
> 
> bar.d
> | class Bar {...whatever...} // Aux object
> 
> foo.d
> | private import bar; // Private could be omitted
> |
> | class Foo {...whatever...}
> 
> main.d
> | import foo;
> |
> | void main()
> | {
> |   Foo f = new Foo;
> |   Bar b = new Bar; // Error, private imported in foo.d
> |   ...
> 
> What are the difficulties of implementing in the language the following?
> 
> foo.d
> | private class Bar {...whatever...} // Aux object
> | class Foo {...whatever...}
> 
> main.d
> | import foo;
> |
> | void main()
> | {
> |   Foo f = new Foo;
> |   Bar b = new Bar; // Error, private member of foo.d
> |   ...
> 
> I would love to see this someday.

I would too. I have already been coding like this with the assumption 
that this is how it is going to work at some point in the future. It is 
after all the only thing that makes sense.

/Oskar



More information about the Digitalmars-d mailing list