www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Protected package?

reply 12345swordy <alexanderheistermann gmail.com> writes:
It says here that:
"package extends private so that package members can be accessed 
from code in other modules that are in the same package. If no 
identifier is provided, this applies to the innermost package 
only, or defaults to private if a module is not nested in a 
package."

Can this be extended to the protected visibility attribute?
If not, then does it need an DIP to do so?

-Alex
Oct 24 2018
parent reply 12345swordy <alexanderheistermann gmail.com> writes:
On Wednesday, 24 October 2018 at 23:36:56 UTC, 12345swordy wrote:
 It says here that:
 "package extends private so that package members can be 
 accessed from code in other modules that are in the same 
 package. If no identifier is provided, this applies to the 
 innermost package only, or defaults to private if a module is 
 not nested in a package."

 Can this be extended to the protected visibility attribute?
 If not, then does it need an DIP to do so?

 -Alex
Well I don't think there no harm of doing so.
Oct 25 2018
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 10/25/18 12:45 PM, 12345swordy wrote:
 On Wednesday, 24 October 2018 at 23:36:56 UTC, 12345swordy wrote:
 It says here that:
 "package extends private so that package members can be accessed from 
 code in other modules that are in the same package. If no identifier 
 is provided, this applies to the innermost package only, or defaults 
 to private if a module is not nested in a package."

 Can this be extended to the protected visibility attribute?
 If not, then does it need an DIP to do so?
Well I don't think there no harm of doing so.
Sorry, I'm not sure what the question is. What is "this" and how is it being extended to protected? FYI, I didn't know that you could package something to a specific identifier, interesting. -Steve
Oct 25 2018
parent reply 12345swordy <alexanderheistermann gmail.com> writes:
On Thursday, 25 October 2018 at 19:48:43 UTC, Steven 
Schveighoffer wrote:
 On 10/25/18 12:45 PM, 12345swordy wrote:
 On Wednesday, 24 October 2018 at 23:36:56 UTC, 12345swordy 
 wrote:
 It says here that:
 "package extends private so that package members can be 
 accessed from code in other modules that are in the same 
 package. If no identifier is provided, this applies to the 
 innermost package only, or defaults to private if a module is 
 not nested in a package."

 Can this be extended to the protected visibility attribute?
 If not, then does it need an DIP to do so?
Well I don't think there no harm of doing so.
Sorry, I'm not sure what the question is. What is "this" and how is it being extended to protected? FYI, I didn't know that you could package something to a specific identifier, interesting. -Steve
The package visibility attribute. It is an extension of private, which means that it is not inheritable.
Oct 25 2018
parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 10/25/18 3:53 PM, 12345swordy wrote:
 On Thursday, 25 October 2018 at 19:48:43 UTC, Steven Schveighoffer wrote:
 On 10/25/18 12:45 PM, 12345swordy wrote:
 On Wednesday, 24 October 2018 at 23:36:56 UTC, 12345swordy wrote:
 It says here that:
 "package extends private so that package members can be accessed 
 from code in other modules that are in the same package. If no 
 identifier is provided, this applies to the innermost package only, 
 or defaults to private if a module is not nested in a package."

 Can this be extended to the protected visibility attribute?
 If not, then does it need an DIP to do so?
Well I don't think there no harm of doing so.
Sorry, I'm not sure what the question is. What is "this" and how is it being extended to protected? FYI, I didn't know that you could package something to a specific identifier, interesting.
The package visibility attribute. It is an extension of private, which means that it is not inheritable.
I think what you are asking is for a "package protected" attribute that acts like protected, but ONLY for modules inside the given package, right? You would need new syntax for this, for sure. So I think a DIP might be required. There is a problem with having package protected be something different, because right now a visibility attribute overrides, not adds to, an existing attribute. -Steve
Oct 25 2018