Thread overview
BUG : import conflict
Oct 01, 2003
Ant
Re: import conflict
Oct 01, 2003
Charles Sanders
Oct 01, 2003
Ant
Oct 01, 2003
jhenzie
Oct 01, 2003
Charles Sanders
October 01, 2003
module A;

private import file;
private import outbuffer;

void main()
{
    string.toString("asdf");

    OutBuffer buf = new OutBuffer();
    buf.write("aaaa");
    file.write("ffff",(byte[])buf.toBytes());
}

I get the compile error:
/dmd/src/phobos/file.d(7): import string conflicts with outbuffer.string at
/dmd/src/phobos/outbuffer.d(16)

if line "string.toString("asdf");" is commented out every thing works as expected.

I tried to make the imports at file.d and outbuffer.d private but got the same error.

Ant


October 01, 2003
Hmm, including

import string;

seems to make it work.

Ive seen similar things ( odd error messages about functions im using but not importing ) but im not sure its an import problem.

C
"Ant" <Ant_member@pathlink.com> wrote in message
news:bldr36$2u32$1@digitaldaemon.com...
> module A;
>
> private import file;
> private import outbuffer;
>
> void main()
> {
>     string.toString("asdf");
>
>     OutBuffer buf = new OutBuffer();
>     buf.write("aaaa");
>     file.write("ffff",(byte[])buf.toBytes());
> }
>
> I get the compile error:
> /dmd/src/phobos/file.d(7): import string conflicts with outbuffer.string
at
> /dmd/src/phobos/outbuffer.d(16)
>
> if line "string.toString("asdf");" is commented out
> every thing works as expected.
>
> I tried to make the imports at file.d and outbuffer.d private but got the same error.
>
> Ant
>
>


October 01, 2003
In article <bldrk7$2v80$1@digitaldaemon.com>, Charles Sanders says...
>
>Hmm, including
>
>import string;
>
>seems to make it work.
>
>Ive seen similar things ( odd error messages about functions im using but not importing ) but im not sure its an import problem.
>
>C

confirmed!
probably Walter will want to make a note of it...

thanks.

Ant


October 01, 2003
Prima facie, because of the lack of an explicit import, the comnpiler seems unable to disambiguate the implicitly imported string symbols from file and outbuffer.

However, making the import string; private should lead to a different message and that is a little concerning.

Perhaps what should be done is to only recognize first level namespaces such that imports in imported modules are not recognized in the current module.

To be honest, I find the concept of them being automatically available somewhat confusing, making a library function / class appear as part of the language.

Just my 2 cents.

Justin



In article <bldrk7$2v80$1@digitaldaemon.com>, Charles Sanders says...
>
>Hmm, including
>
>import string;
>
>seems to make it work.
>
>Ive seen similar things ( odd error messages about functions im using but not importing ) but im not sure its an import problem.
>
>C
>"Ant" <Ant_member@pathlink.com> wrote in message
>news:bldr36$2u32$1@digitaldaemon.com...
>> module A;
>>
>> private import file;
>> private import outbuffer;
>>
>> void main()
>> {
>>     string.toString("asdf");
>>
>>     OutBuffer buf = new OutBuffer();
>>     buf.write("aaaa");
>>     file.write("ffff",(byte[])buf.toBytes());
>> }
>>
>> I get the compile error:
>> /dmd/src/phobos/file.d(7): import string conflicts with outbuffer.string
>at
>> /dmd/src/phobos/outbuffer.d(16)
>>
>> if line "string.toString("asdf");" is commented out
>> every thing works as expected.
>>
>> I tried to make the imports at file.d and outbuffer.d private but got the same error.
>>
>> Ant
>>
>>
>
>


October 01, 2003
> To be honest, I find the concept of them being automatically available
somewhat
> confusing, making a library function / class appear as part of the
language.


Yea I agree, hopefully walter will see this.

C


<jhenzie@mac.com> wrote in message news:blf3gr$2185$1@digitaldaemon.com...
> Prima facie, because of the lack of an explicit import, the comnpiler
seems
> unable to disambiguate the implicitly imported string symbols from file
and
> outbuffer.
>
> However, making the import string; private should lead to a different
message
> and that is a little concerning.
>
> Perhaps what should be done is to only recognize first level namespaces
such
> that imports in imported modules are not recognized in the current module.
>
> To be honest, I find the concept of them being automatically available
somewhat
> confusing, making a library function / class appear as part of the
language.
>
> Just my 2 cents.
>
> Justin
>
>
>
> In article <bldrk7$2v80$1@digitaldaemon.com>, Charles Sanders says...
> >
> >Hmm, including
> >
> >import string;
> >
> >seems to make it work.
> >
> >Ive seen similar things ( odd error messages about functions im using but not importing ) but im not sure its an import problem.
> >
> >C
> >"Ant" <Ant_member@pathlink.com> wrote in message
> >news:bldr36$2u32$1@digitaldaemon.com...
> >> module A;
> >>
> >> private import file;
> >> private import outbuffer;
> >>
> >> void main()
> >> {
> >>     string.toString("asdf");
> >>
> >>     OutBuffer buf = new OutBuffer();
> >>     buf.write("aaaa");
> >>     file.write("ffff",(byte[])buf.toBytes());
> >> }
> >>
> >> I get the compile error:
> >> /dmd/src/phobos/file.d(7): import string conflicts with
outbuffer.string
> >at
> >> /dmd/src/phobos/outbuffer.d(16)
> >>
> >> if line "string.toString("asdf");" is commented out
> >> every thing works as expected.
> >>
> >> I tried to make the imports at file.d and outbuffer.d private but got the same error.
> >>
> >> Ant
> >>
> >>
> >
> >
>
>