private module stuff

Jonathan M Davis jmdavisProg at gmx.com
Sun May 8 04:56:25 PDT 2011


> Jonathan M Davis:
> > They're private _access_ but still visible.
> 
> In my opinion this is not good, it looks like a messy special case.
> 
> > I believe that it's necessary for stuff like
> > where various functions in std.algorithm return auto and return a private
> > struct which you cannot construct yourself.

I believe that C++, C#, and Java all treat private as a matter of access, not 
visibility, though in most cases, there's no real difference in usage. So, 
there's nothing abnormal - quite the opposite really - with D doing what it's 
doing.

> Do you mean something like this? This returns a struct defined inside, but
> it's not a private definition.
> 
> auto foo() {
>   struct Bar {}
>   return Bar();
> }

True. That wasn't the best example, since that's not techinically private, but 
you can run into the same situation with classes or structs which _are_ 
private.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list