should protected imply package?

Denis Koroskin 2korden at gmail.com
Thu Sep 24 13:10:05 PDT 2009


On Thu, 24 Sep 2009 23:36:46 +0400, Jarrett Billingsley  
<jarrett.billingsley at gmail.com> wrote:

> On Thu, Sep 24, 2009 at 1:38 PM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>> In Java, "protected"-level protection implies package-level protection  
>> (see
>> e.g.
>> http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html).
>> Should we copy that behavior in D, or take advantage of the package  
>> keyword
>> and require it as in "package protected"?
>
> Under the current implementation, if protected implied package, all
> protected methods would suddenly become nonvirtual, since for some
> reason, package is treated as a kind of 'private'. Not really what
> you'd want, I think ;)
>
> 'package' should not conflate visibility and virtuality. If it didn't
> do that, having protected imply package would be just fine.

Can't agree more!



More information about the Digitalmars-d mailing list