traits getProtection

Adam D. Ruppe destructionator at gmail.com
Mon Apr 2 05:04:03 PDT 2012


On Monday, 2 April 2012 at 09:26:07 UTC, Dmitry Olshansky wrote:
> It's all nice and well, but I believe part of the reason of say 
> private protection is that user is never ever able to see(!) 
> it. Thus it user can't depend on private members being there, 
> which is a good thing.

That's not the way it is right now in D: if you use the
reflection traits, you can see and access private members.

Worse yet, the way it is now, there's no way to tell
they are marked private when using reflection!

That's one of the reasons why I want to add this - it
lets us check.


I remember asking if private members should be hidden from
reflection before, and the answer was no - I think it had
to do with them being useful for serialization and stuff
like that.


More information about the Digitalmars-d mailing list