[Issue 19589] New: Impossible to determine if a symbol returned by __traits(allMembers) is a module, or package.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 16 06:28:47 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19589

          Issue ID: 19589
           Summary: Impossible to determine if a symbol returned by
                    __traits(allMembers) is a module, or package.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: default_357-line at yahoo.de

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`.

--


More information about the Digitalmars-d-bugs mailing list