inconsistent behavior with implicit imports

timotheecour thelastmammoth at gmail.com
Sun Sep 9 16:47:35 PDT 2012


This works:
----
import std.stdio;
void main(){
	writeln(std.conv.to!double(1));
}
----

This doesn't compile:
----
import std.stdio;
void main(){
	std.stdio.writeln(std.conv.to!double(1));
}
----
=>Error: undefined identifier std

So it seems for conv, import std.conv is not needed, but for 
writeln, import std.stdio is needed. Why?

Also, I always get link errors when using those "implicit 
imports" for my own modules and using "rdmd". Is there a way to 
allow this without link errors in the following (using rdmd) ?
----
void main(){
	mypackage.mymodule.myfun(0);
}
----
which would behave as:
----
import mypackage.mymodule;
void main(){
	myfun(0);
}
----






More information about the Digitalmars-d-learn mailing list