Is there any way to access the your current scope? For instance the
following pseudocode is what I am after more or less:
class Foo
{
alias byte function(int) BarCompatibleInterface;
byte Bar(int)
{
static assert(is(typeof(localscope) == function));
static assert(is(std.traits.ReturnType!(localscope) ==
std.traits.ReturnType!(BarCompatibleInterface));
static assert(is(std.traits.ParameterTypeTuple!(localscope) ==
std.traits.ParameterTypeTuple!(BarCompatibleInterface));
static assert(is(typeof(localscope.outer) == class));
static assert(is(typeof(localscope.outer.outer) == module));
}
}
My desire for this is to help the compiler generate better error
messages from compilation of string mixins, as they could access the
function and/or class they are in and give a better error message from
within a static assert() construct.