static import std.signals - what's wrong?

Hasan Aljudy hasan.aljudy at
Fri Dec 1 13:04:19 PST 2006

Vladimir Bezhenar wrote:
> Code:
> static import std.signals;
> class A {
>     mixin std.signals.Signal!();
> }
> When I try to compile it, there is a lot of confusing messages about errors in
> std/signals.d
> If I remove "static" from the first line, all works ok.

I don't know if Walter would call that "a bug"; it's consistent with the 
specs but IMHO it's a bug. (If it's caused by what I think it is ..)

you're instantiating that template in this file, so the declarations in 
that template are "copied over" to your file, i.e. the scope where the 
mixin happens; but these declaration have dependencies, and these 
dependencies are not available in your file because your import is static.

I'm not sure if that makes any sense at all.

struct A { .. }

template M()
    A a; //this declaration depends on the declaration of struct A


static import a;

mixin a.M!(); //problem, struct A cannot be found from this scope 
(because the import is static)

More information about the Digitalmars-d mailing list