Feedback on Átila's Vision for D

aliak something at something.com
Sun Oct 20 09:54:53 UTC 2019


On Sunday, 20 October 2019 at 09:02:18 UTC, Mike Parker wrote:
> 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;
>
> ...
> ===

Ha! Seems it is d-able.

project/
-- type/
---- package.d // definition of type
---- friends.d // can access package of type and not private of 
type

Thanks, added that data to da faq.




More information about the Digitalmars-d mailing list