Fixing module-scope private

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Jan 27 06:27:21 PST 2013


On 1/27/13 8:58 AM, Dicebot wrote:
> Most annoying for me:
>
> $ cat mod1.d
> module mod1;
>
> private void func(int) { }
>
> $ cat mod2.d
> import mod1;
>
> void main() { func(42); }
>
> $ rdmd mod2.d
> mod2.d(3): Error: module mod2 mod1.func is private
> mod2.d(3): Error: function mod1.func is not accessible from module mod2
>
> With static in C and unnamed namespace in C++ those symbols do not
> participate in outer name resolution at all and do not exist as symbols
> in resulting object file.
>
> Probably there are others, more subtle issues. I'll need to re-parse all
> discussion in that topic if going to try do a DIP about it.

I agree that mod1.func should not even be visible from mod2.

Andrei


More information about the Digitalmars-d mailing list