www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Protection attributes

reply "John C" <johnch_atms hotmail.com> writes:
(Original post at 
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/28704)

Protection attributes on module-level class, struct, interface, enum, 
template, alias and union delcarations (and possibly others) don't work. 
Also, some protection attributes don't work on any module-level 
declarations, eg constants.

Test code:

-prot.d-
module prot;

private interface IEngine {
    void start();
}

private class Engine : IEngine {
    void start() {
    }
}

protected const int DEFAULT_SPOKES = 200;

protected struct Wheel {
    int spokes;
}

-main.d-
module main;

import prot;

int main() {
    Wheel wheel;
    wheel.spokes = DEFAULT_SPOKES;
    IEngine engine = new Engine;
    engine.start();

    return 0;
}
Sep 17 2005
parent =?UTF-8?B?VGhvbWFzIEvDvGhuZQ==?= <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John C schrieb:

 (Original post at 
 http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/28704)
 
 Protection attributes on module-level class, struct, interface, enum, 
 template, alias and union delcarations (and possibly others) don't work. 
 Also, some protection attributes don't work on any module-level 
 declarations, eg constants.
 
 Test code:
 
 -prot.d-
 module prot;
 
 private interface IEngine {
     void start();
 }
 
 private class Engine : IEngine {
     void start() {
     }
 }
Added to DStress as http://dstress.kuehne.cn/nocompile/pprivate_08_A.d http://dstress.kuehne.cn/nocompile/pprivate_08_B.d http://dstress.kuehne.cn/nocompile/pprivate_08_C.d http://dstress.kuehne.cn/nocompile/pprivate_08_D.d http://dstress.kuehne.cn/nocompile/pprivate_08_E.d http://dstress.kuehne.cn/nocompile/pprivate_08_F.d
 protected const int DEFAULT_SPOKES = 200;
 
 protected struct Wheel {
     int spokes;
 }
http://digitalmars.com/d/attribute.html
 
 -main.d-
 module main;
 
 import prot;
 
 int main() {
     Wheel wheel;
     wheel.spokes = DEFAULT_SPOKES;
     IEngine engine = new Engine;
     engine.start();
 
     return 0;
 }
Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDL8/r3w+/yD4P9tIRAogYAKCZ/E5VHdbxC889Wi49bg4uIOevhwCfSsab xOy+y8jcub09jjaEKyZXaK0= =oUqD -----END PGP SIGNATURE-----
Sep 20 2005