www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Module renaming ignored when also using selective import

reply Sebastian Lundstrom <tretton gmail.com> writes:
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
Nov 03 2008
next sibling parent reply Christian Kamm <kamm-incasoftware removethis.de> writes:
 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 .
Nov 03 2008
next sibling parent Sebastian Lundstrom <tretton gmail.com> writes:
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
Nov 04 2008
prev sibling parent bearophile <bearophileHUGS lycos.com> writes:
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
Nov 04 2008
prev sibling parent Gide Nwawudu <gide btinternet.com> writes:
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
Nov 04 2008