traits getProtection

deadalnix deadalnix at gmail.com
Mon Apr 2 23:23:49 PDT 2012


Le 02/04/2012 22:59, Simen Kjærås a écrit :
> On Mon, 02 Apr 2012 20:02:20 +0200, deadalnix <deadalnix at gmail.com> wrote:
>
>>> Now, there are a number of people very unhappy about this state of
>>> affairs and
>>> want private to hide symbols as well (personally, I think that the
>>> fact that
>>> it makes private aliases effectively useless is reason enough to
>>> seriously
>>> reconsider the current behavior), but I don't know if there's any
>>> real chance
>>> of convincing Walter or not.
>>>
>>
>> This would be a huge mistake. For instance, private method are
>> sometime meant to be overridden in subclasses, which is impossible if
>> symbol is inaccessible.
>>
>> NVI for instance would be impossible in such a situation.
>
> NVI is perfectly possible with protected.

You'll loose the ability to define a function, without being able to 
call it.

It is something you want if function have to be called by pair for 
example (using protected here would introduce temporal coupling). It 
make even more sense if you consider combining it with contract programing.


More information about the Digitalmars-d mailing list