www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17768] New: Compile time reflection is missing for

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 puremagic.com
          Reporter: ilyayaroshenko 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

--
Aug 20 2017