how to make private class member private

Nathan S. no.public.email at example.com
Tue Mar 13 22:21:13 UTC 2018


On Tuesday, 13 March 2018 at 09:14:26 UTC, psychoticRabbit wrote:
> what I don't like, is that I have no way at all to protect 
> members of my class, from things in the module, without moving 
> that class out of that module.
>
> D wants me to completely trust the module, no matter what.
>
> That's make a little uncomfortable, given how long and complex 
> modules can easily become(and aleady are)

I used to feel similarly and understand where you're coming from 
but after using D for a while the old way feels ridiculous and 
cumbersome to me. The problem of accidents even in large files 
can be avoided by using names like "m_length" or "_length": no 
jury in the world will believe you if you write those then say 
you didn't know they were private.


More information about the Digitalmars-d-learn mailing list