digitalmars.D - should protected imply package?
- Andrei Alexandrescu (6/6) Sep 24 2009 In Java, "protected"-level protection implies package-level protection
- Jeremie Pelletier (5/13) Sep 24 2009 I make a clear distinction between 'protected' which can be accessed by
- bearophile (5/10) Sep 24 2009 If you are interested in Java Packages you can also take a look at Java ...
- Jarrett Billingsley (8/13) Sep 24 2009 Under the current implementation, if protected implied package, all
- Denis Koroskin (3/18) Sep 24 2009 Can't agree more!
- Don (9/17) Sep 25 2009 Java might be a good source of inspiration.
- Max Samukha (7/27) Sep 25 2009 What about deprecating "package" and employing "protected" to mean
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"? Andrei
Sep 24 2009
Andrei Alexandrescu 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"? AndreiI make a clear distinction between 'protected' which can be accessed by any subclasses no matter their modules or packages, and 'package' which is like public but for the current package only. Jeremie
Sep 24 2009
Andrei Alexandrescu: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"?If you are interested in Java Packages you can also take a look at Java superpackages: http://today.java.net/pub/a/today/2008/03/06/jsr-294-superpackages.html Bye, bearophile
Sep 24 2009
On Thu, Sep 24, 2009 at 1:38 PM, Andrei Alexandrescu <SeeWebsiteForEmail 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.
Sep 24 2009
On Thu, 24 Sep 2009 23:36:46 +0400, Jarrett Billingsley <jarrett.billingsley gmail.com> wrote:On Thu, Sep 24, 2009 at 1:38 PM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Can't agree more!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.
Sep 24 2009
Andrei Alexandrescu 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"? AndreiJava might be a good source of inspiration. Sorting out what 'package' should mean is one of the big remaining issues in D. The current 'package' is a broken implementation of a broken concept. As in one of the bugzilla bugs "package does not work at all". But even if it did work as advertised, it would still suck. Can we announce it as deprecated until we work out what to do with it? We should discourage everyone from using it right now, it's completely broken.
Sep 25 2009
Don wrote:Andrei Alexandrescu wrote:What about deprecating "package" and employing "protected" to mean "accessible from the package, its sub-packages and, if it is a class member, from subclasses in other packages"? The model would be almost equivalent to Java's except we don't need Java's "package-private" (no modifier) because of D's "public by default, private is accessible from anywhere inside the module".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"? AndreiJava might be a good source of inspiration. Sorting out what 'package' should mean is one of the big remaining issues in D. The current 'package' is a broken implementation of a broken concept. As in one of the bugzilla bugs "package does not work at all". But even if it did work as advertised, it would still suck. Can we announce it as deprecated until we work out what to do with it? We should discourage everyone from using it right now, it's completely broken.
Sep 25 2009