Extending D's support for object-oriented design with private(this)

NotYouAgain NotYouAgain at gmail.com
Thu Apr 25 23:31:16 UTC 2024


On Thursday, 25 April 2024 at 13:35:29 UTC, Nick Treleaven wrote:
> It should say whether __traits(getMember), allMembers and 
> .tupleof can access private(this) members.
> ..
> ....

Yes, this would pass as well:
(btw. you can test all this in OpenD, as it already has 
private(this)

module m;
@safe:
import std;

class C
{
   private(this):
     int x;
}

unittest
{
     auto c = new C;

     foreach (i, ref part; c.tupleof)
         writeln(__traits(identifier, c.tupleof[i]));
}



More information about the dip.ideas mailing list