Code That Says Exactly What It Means

Zealot zealot at planet.earth
Thu Oct 30 13:31:48 UTC 2025


On Thursday, 30 October 2025 at 06:21:41 UTC, Peter C wrote:
> But I am genuinely open to listening to a good, rational 
> argument, make no mistake about that.


you ignore the amount of code adding scopeprivate would affect. 
for example any code that uses __traits getVisibility would be 
likely broken by introducing a new case.

metaprogramming also would have new weird special cases.

funnily tupleof would keep working (because it's arguably broken 
now); protection doesn't work the way you think it does anyway, 
consider this:
```d

--- foo.d
module foo;
import std;

     class A {
         private int a = 42;
         protected  int b = 43;
         int c = 44;
     }

     --- bar.d
     import std;
     import foo;
     void main() {
         auto a = new A;
         static foreach(i; 0..a.tupleof.length) {
         	writeln(__traits(getVisibility, a.tupleof[i]), " => ", 
a.tupleof[i]);
         }
     }

     ```


More information about the Digitalmars-d mailing list