Is anything private by default when declared in a module?

Namespace rswhite4 at googlemail.com
Mon Dec 2 12:53:09 PST 2013


On Monday, 2 December 2013 at 20:46:58 UTC, Adam D. Ruppe wrote:
> On Monday, 2 December 2013 at 20:43:23 UTC, Gary Willoughby 
> wrote:
>> Is anything private by default when declared in a module?
>
> I believe imports only. "import foo;" is private, so you write 
> "public import foo;" to expose outside. But other than that, 
> I'm pretty sure everything is public unless you say otherwise.

But sadly named imports aren't private...

/// module foo
private import std.stdio: writeln;

writeln can be used in any module which imports foo. :/


More information about the Digitalmars-d-learn mailing list