[Issue 17768] New: Compile time reflection is missing for module/namespace(c++)/mixin names

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Aug 20 08:46:56 PDT 2017


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

          Issue ID: 17768
           Summary: Compile time reflection is missing for
                    module/namespace(c++)/mixin names
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ilyayaroshenko at gmail.com

Hi,

Could Dlang get something like that please:

__traits(isModule, M)       //for module M;
__traits(isMixinScope, S);  //for mixin Foo S;
__traits(isCppNamespace, N) //for extern(C++, N){}

For module I found ugly and probably not universal workaround:
enum isModule(alias M) = __traits(compiles, { mixin(`import ` ~
fullyQualifiedName!M ~ `;`); });

Current problem is that I need to distinguish ะก++ namespaces and D mixin
scopes.

(working on automated C++/Cython bindings generator).

Best regards,
Ilya

--


More information about the Digitalmars-d-bugs mailing list