Why do private member variables behaved like protected in the same module when creating deriving class?

Neia Neutuladh neia at ikeran.org
Tue Oct 30 01:33:50 UTC 2018


On Mon, 29 Oct 2018 23:16:52 +0000, unprotected-entity wrote:
> On Monday, 29 October 2018 at 15:44:15 UTC, Neia Neutuladh wrote:
>>
>> Java, C++, and C# all treat `private` differently, so if you're saying
>> we should do the exact same as they do, your request is inconsistent
>> and therefore unsatisfiable.
>>
>> I think this is the third time I've pointed it out.
>>
>>
> what 'point' is that.
> 
> can you 'point' it out again for me, cause I'm not clear what the
> 'point' of your 'point' is.

That your request to make D's `private` work like Java, C#, and C++ isn't 
consistent because they work differently from each other.

Do you want to make things work like C++? Then you'll need to add a notion 
of friends.

Do you want to make things work like Java? If you stick with Java-style 
coding with everything in a type and only one top-level type per module, 
that's what we have now.

Do you want to make things work like C#? C# has a very strict notion of 
`private`, no notion of private-to-source-file or private-to-package, and 
a notion of private-to-compilation-unit.

When you say "people will expect this to work like these three other 
languages" and those other languages do that thing differently from each 
other, it's hard to take your claims seriously.

> btw. It's interesting, how a discussion on this matter *always* ends up
> with posts using a tone similar to where you are now going.
>
> i.e. it diverts more and more towards the personal, when people disagree
> with you.

I exercise patience at the start, and it wears thin when people repeatedly 
ignore me.


More information about the Digitalmars-d mailing list