digitalmars.D.learn - Why is compilation failing with this selective import?
- Nick Hamann (14/14) Dec 21 2013 I'm not sure if this is a bug or if I'm doing something wrong.
- Timon Gehr (7/22) Dec 21 2013 The first import seems to introduce the identifier 'std' (+ more). The
I'm not sure if this is a bug or if I'm doing something wrong. Compilation succeeds and the program runs successfully with this code: import std.stdio; import std.conv : to; void main() { auto x = std.conv.to!double("7.3"); writeln(x - 2.2); } However, when I change the first line to "import std.stdio : writeln;", I instead get: : dmd main.d main.d(5): Error: undefined identifier std I'm running DMD 2.064 on 64-bit Arch Linux.
Dec 21 2013
On 12/21/2013 09:56 PM, Nick Hamann wrote:I'm not sure if this is a bug or if I'm doing something wrong. Compilation succeeds and the program runs successfully with this code: import std.stdio; import std.conv : to; void main() { auto x = std.conv.to!double("7.3"); writeln(x - 2.2); } ...The first import seems to introduce the identifier 'std' (+ more). The second import seems to introduce 'conv' into the scope of 'std'.However, when I change the first line to "import std.stdio : writeln;", I instead get: : dmd main.d main.d(5): Error: undefined identifier std ...Now it does not introduce the identifier 'std'.I'm running DMD 2.064 on 64-bit Arch Linux.This part of the language is not specified too well. It cannot hurt to report this though. The current behaviour is non-modular, as which modules are available depends on which modules you imported transitively.
Dec 21 2013