is(x = module) vs. __traits(isModule, x)

Adam D. Ruppe destructionator at gmail.com
Wed Oct 7 19:44:52 UTC 2020


On Wednesday, 7 October 2020 at 18:46:07 UTC, Steven 
Schveighoffer wrote:
> Why both?

Why *either*?

The real WTF is that modules - which are not actually a child 
member of another module - is returned in listings of 
__traits(allMembers).

That's the root bug and should be fixed. These were just added to 
let user code hack around this bug instead of just fixing the bug 
in the compiler.

If you want to get imports, we should provide an alternate trait 
for that.

> is(std == package) == __traits(isPackage, std);

And this is broken af right now anyway. As of the newest dmd, 
trying to actually modules from imports slams into a brick wall.

The status quo is even worse than it was a couple releases ago... 
and it was already broken. Let's just fix it all.


More information about the Digitalmars-d mailing list