www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - stdio.d & stream.d

reply Mista <stoop hotpop.com> writes:
I switched from v0.95 to v0.100 and now i get the following error message:

C:\DMD\BIN\..\src\phobos\std\stream.d(2072): variable stdout conflicts 
with stdio.stdout at C:\DMD\BIN\..\src\phobos\std\c\stdio.d(131)
C:\DMD\BIN\..\src\phobos\std\stream.d(2072): variable stdin conflicts 
with stdio.stdin at C:\DMD\BIN\..\src\phobos\std\c\stdio.d(130)
Aug 21 2004
parent reply Mista <stoop hotpop.com> writes:
Mista wrote:

 I switched from v0.95 to v0.100 and now i get the following error message:
 
 C:\DMD\BIN\..\src\phobos\std\stream.d(2072): variable stdout conflicts 
 with stdio.stdout at C:\DMD\BIN\..\src\phobos\std\c\stdio.d(131)
 C:\DMD\BIN\..\src\phobos\std\stream.d(2072): variable stdin conflicts 
 with stdio.stdin at C:\DMD\BIN\..\src\phobos\std\c\stdio.d(130)

line 9 of phobos\std\stdio.d has been changed in v0.100 from private import std.c.stdio; to import std.c.stdio; I changed it back to the way it was in v0.95 and that works, but i guess the change was made for a reason.
Aug 21 2004
next sibling parent reply Arcane Jill <Arcane_member pathlink.com> writes:
In article <cg7bt2$1rv0$1 digitaldaemon.com>, Mista says...

line 9 of phobos\std\stdio.d has been changed in v0.100 from
private import std.c.stdio;
to
import std.c.stdio;

Oh yuk! If I choose to import std.c.stdio, I'd prefer to say so with an import statement of my own. Non-private imports within libraries are just plain rude.
I changed it back to the way it was in v0.95 and that works, but i guess 
the change was made for a reason.

Well, I hope it's an honest mistake. Polluting my namespace against my will on purpose should be a punishable offense. Jill
Aug 21 2004
next sibling parent Benjamin Herr <ben 0x539.de> writes:
Arcane Jill wrote:
 Well, I hope it's an honest mistake. Polluting my namespace against my will on
 purpose should be a punishable offense.

What happened to the notion to make import privately import by default? Might break some old code, but nothing that cannot be fixed with some quick :%s/import/public import/g or the like.
Aug 21 2004
prev sibling parent "antiAlias" <fu bar.com> writes:
Absolutely. Imports should be private by default; there's no practical
reason for them to be otherwise. In fact, if they were private by default,
I'd imagine the compiler might actually be a little faster on larger
projects <g>


"Arcane Jill" <Arcane_member pathlink.com> wrote in message
news:cg882a$2asb$1 digitaldaemon.com...
 In article <cg7bt2$1rv0$1 digitaldaemon.com>, Mista says...

line 9 of phobos\std\stdio.d has been changed in v0.100 from
private import std.c.stdio;
to
import std.c.stdio;

Oh yuk! If I choose to import std.c.stdio, I'd prefer to say so with an import

 of my own. Non-private imports within libraries are just plain rude.


I changed it back to the way it was in v0.95 and that works, but i guess
the change was made for a reason.

Well, I hope it's an honest mistake. Polluting my namespace against my

 purpose should be a punishable offense.

 Jill

Aug 21 2004
prev sibling parent reply Arcane Jill <Arcane_member pathlink.com> writes:
In article <cg7bt2$1rv0$1 digitaldaemon.com>, Mista says...
Mista wrote:

 I switched from v0.95 to v0.100 and now i get the following error message:
 
 C:\DMD\BIN\..\src\phobos\std\stream.d(2072): variable stdout conflicts 
 with stdio.stdout at C:\DMD\BIN\..\src\phobos\std\c\stdio.d(131)
 C:\DMD\BIN\..\src\phobos\std\stream.d(2072): variable stdin conflicts 
 with stdio.stdin at C:\DMD\BIN\..\src\phobos\std\c\stdio.d(130)


It's worth remembering what C++ did. C++ made compatibility with C not just a desirable thing, but an absolute requirement, and so "stdin" and "stdout" had to retain their old C usage. But STL introduced std::streams, and these streams also had their own concept of "standard input" and "standard output". How did they resolve the problem? Did they use the old names but put them in a new namespace? No - they called the new streams "cin" and "cout" to completely avoid conflict. Presumably, D could do the same - rename std.stream.stdin as std.stream.cin and std.stream.stdout as std.stream.cout. Voila, no conflict. Of course, what I'd /prefer/ is that we didn't get a load of junk thrown into our namespaces as a consequence of non-private imports within libraries, but I mention this as a second possible resolution in case for some horrible reason those non-private imports can't be got rid of. Arcane Jill
Aug 21 2004
parent Regan Heath <regan netwin.co.nz> writes:
On Sat, 21 Aug 2004 20:12:28 +0000 (UTC), Arcane Jill 
<Arcane_member pathlink.com> wrote:

<snip>

 Presumably, D could do the same - rename std.stream.stdin as 
 std.stream.cin and
 std.stream.stdout as std.stream.cout. Voila, no conflict.

What about din and dout <g> Regan -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Aug 22 2004