On Monday, 31 August 2015 at 23:36:25 UTC, Enamex wrote:
I'm not sure whether a naked 'local.S' should work; sometimes
it does and sometimes it doesn't. But an `static import local;`
then `voidfoo(local.S)` definitely works.
`static import` forces the imported symbols to be fully
qualified on use. It basically only allows the module to
recognize the existence of modules outside its package.
Doing `import app: foo;` or even just `import app;` would never
import `module app;`'s imports unless those imports are public.
`module foo; public static import local; import bazoo;`
`module bar; void fun() { local.S s; } // works
void fun2() { bazoo.B b; } // error`
I'm following some of your post, but not quite all of it
(particularly the part at the end, and I also think static
imports can't be selective). Anyway, I was thinking about
something like below as one possible alternative
struct T
{
import local : S;
void foo(S s)
{
import std.stdio : writeln;
writeln(s.a);
}
}