On Monday, 26 November 2012 at 12:32:08 UTC, Manu wrote:
2.
import std.stdio;
pragma(msg, !is(std) && is(typeof(std))); // <- true?!
std.stdio is a module, it looks like a variable. typeof(std) ==
void...
What the? Why does it even have a type?
I can't find a sensible way to distinguish std from any other
regular
variable.
traits uses something like this (see fullyQualifiedName)
Thanks
Dan
import std.stdio;
template isPackage(alias name) {
static if(name.stringof.length >= 9 && name.stringof[0..8] ==
"package ") {
enum isPackage = true;
} else {
enum isPackage = false;
}
}
void main() {
pragma(msg, "Is std a package:", isPackage!std);
pragma(msg, "Is std.stdio a package:", isPackage!(std.stdio));
}