Import all?

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Wed Jul 17 12:28:58 PDT 2013


On Wednesday, 17 July 2013 at 11:45:09 UTC, monarch_dodra wrote:
> //main.d
> import a;
> void main()
> {
>     foo(); //OK
>     bar(); //OK
>     a.foo(); //OK (!!!)
>     a.bar(); //OK (!!!)
>     a.b.foo(); //OK
>     a.c.bar(); //OK
> }
> //===============================
>
> To be frank, I don't know if this is a bug, or a feature...

Public import adds the symbols to the module and makes them 
public, by default they are private.

     foo();
     a.foo();

These are equivalent since a contains the symbols of b. This is 
has the annoyance:

     import a, b;

     foo() // Ambiguous a.foo and b.foo()


More information about the Digitalmars-d-learn mailing list