digitalmars.D.learn - How to tell an identifier is a module?
- bearophile (10/10) Jan 26 2015 __traits(allMembers, mixin(__MODULE__)) also yields a module name
- Rikki Cattermole (6/15) Jan 26 2015 static if (__traits(compiles, {mixin("import MODULENAME;");})) {
__traits(allMembers, mixin(__MODULE__)) also yields a module name like object, but then how can you find out that "object" is a module? This doesn't work: void main() { pragma(msg, is(int == int)); pragma(msg, is(object == module)); } Bye, bearophile
Jan 26 2015
On 27/01/2015 2:25 a.m., bearophile wrote:__traits(allMembers, mixin(__MODULE__)) also yields a module name like object, but then how can you find out that "object" is a module? This doesn't work: void main() { pragma(msg, is(int == int)); pragma(msg, is(object == module)); } Bye, bearophilestatic if (__traits(compiles, {mixin("import MODULENAME;");})) { // true } else { // false }
Jan 26 2015