On Monday, September 10, 2012 01:47:35 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? > > 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); > } > ----
Any and all implicit imports are a _bug_. They should _never_ happen. You should have to import both std.stdio and std.conv. If you don't have to, then you've found a bug. The _only_ exception is when one module publicly imports another, which Phobos _does_ do in a few places, but it definitely doesn't do that here. Nether of your examples should compile. - Jonathan M Davis