Extending D's support for object-oriented design with private(this)
NotYouAgain
NotYouAgain at gmail.com
Thu Apr 25 23:13:54 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.
> ..
> ...
This unittest would pass:
module m;
@safe:
import std;
class C
{
private(this):
int x;
}
unittest
{
auto c = new C;
static assert(__traits(getVisibility, C.x) ==
"private(this)");
static assert(__traits(hasMember, C, "x") == true);
}
More information about the dip.ideas
mailing list