Thread overview
visibility of private Class C in module named "C"; private variables in modules
Dec 26
kdevel
Dec 26
kdevel
Dec 26
kdevel
Dec 27
kdevel
December 26
~~~Private.d
module Private;

class A {}
private class B {}
package class Private {
   void foo () { __PRETTY_FUNCTION__.writeln; }
}
~~~

~~~main.d
void main ()
{
   import Private: A; // okay
//   import Private: B; // main.d(4): Error: module Private member B
                        // is not visible from module main
                        // okay

//   import Private: Private; // main.d(8): Error: module Private member
                            // Private is not visible from module main
                            // oh-kay, but

   import Private;
   auto p = new Private; // works, but Private.Private is private ?!?
   p.foo;
}
~~~

I don't get it. Furthermore according to

   https://wiki.dlang.org/Access_specifiers_and_visibility#private

there is always external linkage on private variables and functions.
Does D not provide a means to stop symbols from going into the object file?
December 26
On Saturday, 26 December 2020 at 15:58:30 UTC, kdevel wrote:

> package class Private {
>    void foo () { __PRETTY_FUNCTION__.writeln; }
> }

>
>    import Private;
>    auto p = new Private; // works, but Private.Private is private ?!?

You've declared `Private` as `package`.
December 26
On Saturday, 26 December 2020 at 17:48:17 UTC, Mike Parker wrote:
> On Saturday, 26 December 2020 at 15:58:30 UTC, kdevel wrote:
>
>> package class Private {
>>    void foo () { __PRETTY_FUNCTION__.writeln; }
>> }
>
>>
>>    import Private;
>>    auto p = new Private; // works, but Private.Private is private ?!?
>
> You've declared `Private` as `package`.

Hit but not sunk. It makes no difference:

~~~Private.d
module Private;
import std.stdio: writeln;

class A {}
private class B {}
private class Private {
   void foo () { __PRETTY_FUNCTION__.writeln; }
}
~~~

$ dmd main.d
$ ./main
void Private.Private.foo()

December 26
On Saturday, 26 December 2020 at 18:43:19 UTC, kdevel wrote:
> $ dmd main.d

$ dmd -i main
December 27
bugreport filed https://issues.dlang.org/show_bug.cgi?id=21508