Andrei Alexandrescu wrote:
BCS wrote:
Hello Andrei,
Nick Sabalausky wrote:
Stdout.formatln("{}", __FUNCTION__);
I think instead of __FUNCTION__ we'll define a much more comprehensive
static reflection facility.
for the above case I think __FUNCTION__ is as good as it will get.
Define it as a human readable identifier rather than reflection.
You will have it as a human readable identifier too. The problem with
__FUNCTION__, __CLASS__ etc. is that the list of ad-hoc names (what
happened to __STRUCT__, __MODULE__ et al?) can go forever.
For classes and structs, this is already possible: typeof(this).stringof
Now we only need a way to get some kind of compile time object for
functions and modules (like the type for classes/structs). Then you
simply can use .stringof on them.
Andrei