Feedback on Átila's Vision for D

Mike Parker aldacron at gmail.com
Sun Oct 20 09:02:18 UTC 2019


On Sunday, 20 October 2019 at 08:44:37 UTC, aliak wrote:
> On Sunday, 20 October 2019 at 05:43:52 UTC, Walter Bright wrote:

>>
>> In D, declarations are grouped into a module that would 
>> otherwise need "friend" access if it were developed in C++.
>
> Yeah this was related to benefits around being able to keep 
> some things private from your friends (which is not d-able 
> currently).

===
module mypack.publicstuff.stuff.secretstuff;

class SecretStuff {
    public foo {}
    package friendlyFoo {]
    private secretFoo {]
}

===
module mypack.publicstuff.stuff.friends;

void beFriendly(SecretStuff s) {
    s.friendlyFoo();
}
...
===
module mypack.publicstuff;

public import mypack.publicstuff.stuff.friends,
               mypack.publicstuff.stuff.secretstuff;

...
===



More information about the Digitalmars-d mailing list