Thread overview
does "private import" means "static import" to other modules importing it?
Oct 13, 2011
Cheng Wei
Oct 13, 2011
Andrej Mitrovic
Oct 14, 2011
Jesse Phillips
Oct 14, 2011
Andrej Mitrovic
Oct 14, 2011
Nick Sabalausky
October 13, 2011
suppose we have in module A, we have
import B;

Then in module C;

import A;
B.fun1();
B.fun2();

can be compiled successfully even without "static import B".

Is this correct? Thanks.
October 13, 2011
You can always qualify the full name unless you're importing a specific symbol, e.g.:

module A;
import B : fun1;

module C;
import A;
fun1();  // ok
B.fun1(); // not ok
B.fun2(); // not ok

static import just means you can't use the symbol without qualifying
the full package/module name before it:
module A;
static import B;

module C;
import A;
B.fun1();  // ok
B.fun2(); // ok
fun1(); // not ok

I think that should be it.
October 14, 2011
"Cheng Wei" <rivercheng@gmail.com> wrote in message news:j76dc6$1fcu$1@digitalmars.com...
>
> does "private import" means "static import" to other modules importing it?

It's not supposed to, but it does at the moment due to a bug.


October 14, 2011
On Thu, 13 Oct 2011 16:21:56 +0200, Andrej Mitrovic wrote:

> You can always qualify the full name unless you're importing a specific symbol, e.g.:

No, I'm pretty sure it is just a bug, and one that was recently discussed too. Private imports should not expose their symbols to other modules even if you use a fully qualified name.

October 14, 2011
On 10/14/11, Jesse Phillips <jessekphillips+d@gmail.com> wrote:
> On Thu, 13 Oct 2011 16:21:56 +0200, Andrej Mitrovic wrote:
>
>> You can always qualify the full name unless you're importing a specific symbol, e.g.:
>
> No, I'm pretty sure it is just a bug, and one that was recently discussed too. Private imports should not expose their symbols to other modules even if you use a fully qualified name.
>

Woops, sorry for the slip-up.