traits getProtection

Dmitry Olshansky dmitry.olsh at gmail.com
Mon Apr 2 06:05:09 PDT 2012


On 02.04.2012 16:04, Adam D. Ruppe wrote:
> 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!
>

Awful.

> 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.

Now I get it, traits hasIndirections would need it too, and it's too big 
a feat to lose it.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list