digitalmars.D - Feature Enhancement: Protection attributes should work the same in
- Bruno Medeiros (26/26) Mar 14 2006 Feature Enhancement: Protection attributes should work the same in all
- Jarrett Billingsley (3/11) Mar 14 2006 Vote!
- Kyle Furlong (2/34) Mar 14 2006 This is obvious, any modern language needs this. Vote.
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
"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. (thisVote!
Mar 14 2006
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









"Jarrett Billingsley" <kb3ctd2 yahoo.com> 