View mode: basic / threaded / horizontal-split · Log in · Help
November 03, 2008
Module renaming ignored when also using selective import
Hi! I'm using DMD 1.033 (with tangobos), so I'm not really sure about this one. But when I both rename and use a selective import, the renaming doesn't seem to have any effect:

import mystdout = tango.io.Stdout : Stdout;
void main()
{
	Stdout("Should require mystdout prefix?");
}

The above code compiles and runs just fine. Same code attached to the post.

Thank you for a great language!
-Seb
November 04, 2008
Re: Module renaming ignored when also using selective import
> import mystdout = tango.io.Stdout : Stdout;
> void main()
> {
> Stdout("Should require mystdout prefix?");
> }

No, this behaves as specified: you get Stdout from the selective import and
tango.io.Stdout as mystdout from the rename. See 'Renamed and Selective
Imports' in
http://www.digitalmars.com/d/1.0/module.html#ImportDeclaration .
November 04, 2008
Re: Module renaming ignored when also using selective import
Christian Kamm Wrote:

> > import mystdout = tango.io.Stdout : Stdout;
> > void main()
> > {
> > Stdout("Should require mystdout prefix?");
> > }
> 
> No, this behaves as specified: you get Stdout from the selective import and
> tango.io.Stdout as mystdout from the rename. See 'Renamed and Selective
> Imports' in
> http://www.digitalmars.com/d/1.0/module.html#ImportDeclaration .

Ah, my bad!
-Seb
November 04, 2008
Re: Module renaming ignored when also using selective import
Christian Kamm:
> > import mystdout = tango.io.Stdout : Stdout;
> > void main()
> > {
> > Stdout("Should require mystdout prefix?");
> > }
> 
> No, this behaves as specified: you get Stdout from the selective import and
> tango.io.Stdout as mystdout from the rename.

I think that's a bit confusing syntax.

Bye,
bearophile
November 04, 2008
Re: Module renaming ignored when also using selective import
On Mon, 03 Nov 2008 15:37:09 -0500, Sebastian Lundstrom
<tretton@gmail.com> wrote:
>import mystdout = tango.io.Stdout : Stdout;
> void main()
> {
>	Stdout("Should require mystdout prefix?");
> }

D is behaving as expected, see the section 'Renamed and Selective
Imports'.
http://www.digitalmars.com/d/2.0/module.html

Gide
Top | Discussion index | About this forum | D home