Bug 17768 – Compile time reflection is missing for module/namespace(c++)/mixin names

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-08-20T15:46:56Z
Last change time
2024-12-13T18:54:12Z
Keywords
C++
Assigned to
No Owner
Creator
Илья Ярошенко
Moved to GitHub: dmd#19305 →

Comments

Comment #0 by ilyayaroshenko — 2017-08-20T15:46:56Z
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
Comment #1 by pro.mathias.lang — 2020-02-19T04:59:44Z
Is it still needed ? For C++ namespace I would highly recommend to use `extern(C++, "namespace")` which does not introduce a scope.
Comment #2 by robert.schadek — 2024-12-13T18:54:12Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19305 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB