I was thinking about using mixin templates to put some module-level default information in a single file so that it doesn't clutter up other files. It works for imports, but it doesn't seem to propagate for function attributes.

module_default.d
-------------------
module module_default;

mixin template module_default()
{
        import std.traits : functionAttributes;
        import std.stdio : writeln;
        
        @safe:
}

app.d
-------------------
import module_default;

mixin module_default;

int foo(int x)
{
        return x;
}

void main() {
        
        writeln(functionAttributes!foo);
}

Compiled with dmd app.d module_default.d on Windows 7 64bit. The output is system, when I would expect it to be safe.

I'm not sure if this is how the behavior is supposed to be or if it is a bug.

Reply via email to