On 09/10/2012 01:47 AM, timotheecour wrote:
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?


I assume because std.stdio imports std.conv, but not vice versa.

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);
}
----


This is a quirk of DMD, not a language feature.
You can file the implicit import behaviour as a bug.

Reply via email to