D - Variable stdin conflicts with certain phobos imports
- DDevil (16/16) Mar 09 2003 I'm using DMD 0.59. Try this:
- Burton Radons (2/19) Mar 09 2003 Use "stream.stdin" to reference it. This is why I want private imports.
- DDevil (21/27) Mar 10 2003 I was just playing with importing "string" and "math" and got into a
I'm using DMD 0.59. Try this: import stream; import math; int main() { stdin.readLine(); return 0; } When trying to compile I get: c:\dmd\bin\..\src\phobos\stream.d(1341): variable stdin conflicts with stdio.std in at c:\dmd\bin\..\src\phobos\c\stdio.d(69) That's not the only combination of imports that will give the error. I seem to get the error with all sorts of variations when stream is imported. Thanks for any help. -- // DDevil
Mar 09 2003
DDevil wrote:I'm using DMD 0.59. Try this: import stream; import math; int main() { stdin.readLine(); return 0; } When trying to compile I get: c:\dmd\bin\..\src\phobos\stream.d(1341): variable stdin conflicts with stdio.std in at c:\dmd\bin\..\src\phobos\c\stdio.d(69) That's not the only combination of imports that will give the error. I seem to get the error with all sorts of variations when stream is imported.Use "stream.stdin" to reference it. This is why I want private imports.
Mar 09 2003
Burton Radons wrote:DDevil wrote:I was just playing with importing "string" and "math" and got into a similar situation with atof(). It seems to me that this may be more of a problem with the libraries and error messages rather than the language itself (?). I would think that normally your core libraries should not conflict with each other. (eg. why is there an atof in both string _and_ math? Why is there a stdin in both stream and c.stdio? Shouldn't one import from the other?). With alias you can "fix" normal conflicts... I just wasn't expecting the standard library to conflict with itself. The error messages seem to make sense but are less clear than what you would get out of most C++ compilers when a namespace conflict occurs. GCC will output something like: test.cpp: In function `int main()': test.cpp:16: use of `i' is ambiguous test.cpp:8: first declared as `int Foo::i' here test.cpp:3: also declared as `int Bar::i' here Which shows exactly where you were trying to use the conflicting item and why this is an error in the first place. -- // DDevilWhen trying to compile I get: c:\dmd\bin\..\src\phobos\stream.d(1341): variable stdin conflicts with stdio.stdin at c:\dmd\bin\..\src\phobos\c\stdio.d(69)Use "stream.stdin" to reference it. This is why I want private imports.
Mar 10 2003