Bug 19589 – Impossible to determine if a symbol returned by __traits(allMembers) is a module, or package.
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-01-16T06:28:47Z
Last change time
2022-09-29T15:19:46Z
Assigned to
No Owner
Creator
FeepingCreature
Comments
Comment #0 by default_357-line — 2019-01-16T06:28:47Z
When a module is imported, it will show up in __traits(allMembers, <containing scope>) as a member, but there is no way to determine that it is a module (or package) other than inspecting its stringof.
import std.stdio;
pragma(msg, std.stdio.stringof); returns "module stdio".
A possible solution would be traits `isModule` and `isPackage`.