On Thursday, 12 April 2012 at 15:36:25 UTC, Justin Whear wrote:
On Thu, 12 Apr 2012 16:11:11 +0200, dcoder wrote:
My question is, how do I change the code above so that it
works even if I change the name of the file/module? I'm
looking for
clean solution something like a macro if one actually exists.
Check out packageName, moduleName, and fullyQualifiedName in
std.traits.
Additionally, the __FILE__ token will be expanded to the name
of the
current file.
Justin
Thanks for this info. I tried it but I'm still getting some
problems.
Here's what I have for code:
/* traits.d
*/
import std.stdio, std.traits;
void main() {
writefln( "moduleName = %s ", moduleName!(main));
return;
}
When I try to compile this, I get the following error:
traits.d(7): Error: undefined identifier moduleName
Could it be my compiler version? Here's what I have:
$ dmd
DMD32 D Compiler v2.055
By the way, I am doing this in cygwin, I don't know if that
matters.
thanks