how to make private class member private
psychoticRabbit
meagain at meagain.com
Tue Mar 13 05:11:48 UTC 2018
On Tuesday, 13 March 2018 at 02:24:38 UTC, Mike Parker wrote:
> On Tuesday, 13 March 2018 at 02:06:57 UTC, psychoticRabbit
> wrote:
>>
>> Mmm.. I don't think I like it.
>>
>> I feel you should be able to make a member of a class,
>> private, regardless of where the class is located. This seems
>> to break the concept of class encapsulation.
>>
>> No. I don't like it at all.
>
> If you have access to the module source, you have access to the
> source of types inside it. Making the module the lowest level
> of encapsulation makes sense from that perspective.
There are two problems I see:
1st - D has broken the concept of class encapsulation, simply for
convenience at the module level. Not good in my opinion.
2nd - C++/C#/Java programmers will come to D, use the same
syntax, but get very different semantics. Not good in my opinion.
(i.e. I only realised private was not private, by accident).
D has made many good design decisions. I do not see this as one
of them.
More information about the Digitalmars-d-learn
mailing list