www.digitalmars.com         C & C++   DMDScript  

D - BUG : import conflict

reply Ant <Ant_member pathlink.com> writes:
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
Sep 30 2003
parent reply "Charles Sanders" <sanders-consulting comcast.net> writes:
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
Oct 01 2003
next sibling parent Ant <Ant_member pathlink.com> writes:
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
Sep 30 2003
prev sibling parent reply jhenzie mac.com writes:
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
Oct 01 2003
parent "Charles Sanders" <sanders-consulting comcast.net> writes:
 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
Oct 01 2003