On Monday, 31 August 2015 at 21:22:07 UTC, jmh530 wrote:
I'm not sure about how the first local.S resolves things. I had been using a selective import for S before. To get the local.S to compile, I have to change the import to a normal one. I'm concerned about the case where local contains more than just S. Suppose I import app : foo; in another module, wouldn't this import all of local? Alternately, suppose I create some function baz that does not use S in any way, then if I import app : baz, then I will inadvertently import local, correct?

The second thing does not compile for me (I had tried that already...). I get

app.d(3): Error: declaration expected, not '{'
app.d(10): Error: unrecognized declaration

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`

Reply via email to