www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Feature Enhancement: Protection attributes should work the same in

reply Bruno Medeiros <daiphoenixNO SPAMlycos.com> writes:
Feature Enhancement: Protection attributes should work the same in all 
entities, not just functions and variables.

Currently the D spec (http://www.digitalmars.com/d/attribute.html) 
states implicitly that protection attributes apply only to members (of 
classes and modules), with members being functions and variables. I 
propose that the protection attributes work orthogonally for all 
entities, meaning they should also apply to declarative entities like 

This would allow access control in ways such as these:

----- moduleA
   private class Foo {
     public static void staticMethod() {}
   }

----- moduleB
   // Accessing a class as part of another entity's access
   moduleA.Foo.staticMethod(); // error: cannot access Foo

   // Accessing a class as a direct usage in a declaration
   Foo foo; // error: cannot access Foo


In the case of accessing a constructor (instantiating a class), access 
it allowed if both the protection attribute of the class, and the class 



Note: There is also currently a bug that makes protection attributes not 
work with static members.

-- 
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Mar 14 2006
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Bruno Medeiros" <daiphoenixNO SPAMlycos.com> wrote in message 
news:dv7816$q0b$3 digitaldaemon.com...
 Feature Enhancement: Protection attributes should work the same in all 
 entities, not just functions and variables.

 Currently the D spec (http://www.digitalmars.com/d/attribute.html) states 
 implicitly that protection attributes apply only to members (of classes 
 and modules), with members being functions and variables. I propose that 
 the protection attributes work orthogonally for all entities, meaning they 
 should also apply to declarative entities like classes and structs. (this 

Vote!
Mar 14 2006
prev sibling parent Kyle Furlong <kylefurlong gmail.com> writes:
Bruno Medeiros wrote:
 Feature Enhancement: Protection attributes should work the same in all 
 entities, not just functions and variables.
 
 Currently the D spec (http://www.digitalmars.com/d/attribute.html) 
 states implicitly that protection attributes apply only to members (of 
 classes and modules), with members being functions and variables. I 
 propose that the protection attributes work orthogonally for all 
 entities, meaning they should also apply to declarative entities like 

 This would allow access control in ways such as these:
 
 ----- moduleA
   private class Foo {
     public static void staticMethod() {}
   }
 
 ----- moduleB
   // Accessing a class as part of another entity's access
   moduleA.Foo.staticMethod(); // error: cannot access Foo
 
   // Accessing a class as a direct usage in a declaration
   Foo foo; // error: cannot access Foo
 
 
 In the case of accessing a constructor (instantiating a class), access 
 it allowed if both the protection attribute of the class, and the class 

 
 
 Note: There is also currently a bug that makes protection attributes not 
 work with static members.
 
This is obvious, any modern language needs this. Vote.
Mar 14 2006