Focus

Peter Alexander peter.alexander.au at gmail.com
Mon Jan 21 05:16:02 PST 2013


On Monday, 21 January 2013 at 12:55:36 UTC, eles wrote:
> On Saturday, 19 January 2013 at 01:35:58 UTC, Walter Bright 
> wrote:
>> On 1/18/2013 4:55 PM, Andrey wrote:
>> This all falls apart once you decide you need "friend" access.
>
> What is wrong with this POV is that the original class no 
> longer has a word to say if she wants to be friended by someone.
>
> In C++ the class has a word to say: if it does not declare: 
> "hey! you will be my friend!", then nobody can come there to 
> say: "hey! I consider myself your friend (even if you don't 
> want it), so I will mess up your internal state!"

Only if that class is in the same module.

This is being blown completely out of proportion.

A few things to consider:

- Lots of languages don't have access control at all, yet somehow 
people use them without problem.
- As far as I can see, the DMD source has very few private 
variables, yet very few (if any) bugs are caused by people 
messing up other people's variables.
- If you have one class per module, D is no different to 
C++/Java/C#.


More information about the Digitalmars-d mailing list