Adding a new design constraint to D

Dom Disc dominikus at scherkl.de
Tue Jun 14 21:13:32 UTC 2022


On Tuesday, 14 June 2022 at 20:41:35 UTC, Ola Fosheim Grøstad 
wrote:
> On Tuesday, 14 June 2022 at 20:04:14 UTC, Dom Disc wrote:
>> On Tuesday, 14 June 2022 at 17:24:31 UTC, Ola Fosheim Grøstad 
>> wrote:
>>> On Tuesday, 14 June 2022 at 17:16:04 UTC, Dom Disc wrote:
>>>> If it's a member, you can do nothing about it - not with 
>>>> module level nor with class level privacy. Also not in C++ 
>>>> or Java or any other language I know about.
>>>
>>> Not sure what you meant by this. You can make the member a 
>>> class that has its own privacy with a selective set of 
>>> friends.
>>
>> What I mean is: You cannot prevent a member function from 
>> having access to the private variables of the class. Even if 
>> it should not touch them.
>
> This seems to compile:

Ok, you got me.
Didn't thought about friends of sub-classes.
But in D I don't know ... maybe something similar is possible?



More information about the Digitalmars-d mailing list