On Friday, 30 May 2014 at 20:02:40 UTC, Steven Schveighoffer wrote:

If you want an opaque struct, you need to return it by pointer.

What do you mean? Like this?

Hidden* foo() { return new Hidden();}

?

Otherwise, the user must be able to know what type it is (otherwise, how would he use it?)

I just fear that by using internal, public, functions, the user might get access to a private type. I guess the D answer to that is to make foo private also. That makes sense.

I now realize that I implicitly considered 'private' to be transitive (or viral). That is that:

Hidden foo() { return Hidden();}

as foo is returning a value from a private type, it should be considered private also. By the compiler, I mean.

Reply via email to