www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - 4 Qs about std.stdio

reply "Carlos Santander B." <csantander619 gmail.com> writes:
Walter, I have 4 questions about std.stdio. They're just pure, honest 
ignorance, nothing else.

1. Why is std.c.stdio publicly imported? (notice std.utf and std.format 
are private)
2. std.stdio defines FPUTC et al. Why are they public?
3. Why keep std.c.stdio.FILE instead of using std.stream.Stream? Ok, 
maybe for the internal representantion (because writex works with 
std.c.stdio), but fwritef/fwritefln (IMHO) should get a Stream, and not 
a FILE *. I mean, we're trying to leave C behind, right?
4. Will we ever see a readf or similar in Phobos?

(1) and (2) are just because I think the namespace could get too 
bloated, and that doesn't seem to be a good thing.

_______________________
Carlos Santander Bernal
Jan 31 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Carlos Santander B." <csantander619 gmail.com> wrote in message
news:ctmjp1$23i5$1 digitaldaemon.com...
 Walter, I have 4 questions about std.stdio. They're just pure, honest
 ignorance, nothing else.

 1. Why is std.c.stdio publicly imported? (notice std.utf and std.format
 are private)
Because I viewed std.stdio as extending std.c.stdio, not replacing it.
 2. std.stdio defines FPUTC et al. Why are they public?
No good reason.
 3. Why keep std.c.stdio.FILE instead of using std.stream.Stream? Ok,
 maybe for the internal representantion (because writex works with
 std.c.stdio), but fwritef/fwritefln (IMHO) should get a Stream, and not
 a FILE *. I mean, we're trying to leave C behind, right?
I suggest adding a writef to std.stream.
 4. Will we ever see a readf or similar in Phobos?
Yes.
 (1) and (2) are just because I think the namespace could get too
 bloated, and that doesn't seem to be a good thing.

 _______________________
 Carlos Santander Bernal
Jan 31 2005
next sibling parent reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
 3. Why keep std.c.stdio.FILE instead of using std.stream.Stream? Ok,
 maybe for the internal representantion (because writex works with
 std.c.stdio), but fwritef/fwritefln (IMHO) should get a Stream, and not
 a FILE *. I mean, we're trying to leave C behind, right?
I suggest adding a writef to std.stream.
already done. The std.stream equivalent to import std.stdio; int main() { writefln("hello world"); return 0; } is import std.stream; int main() { stdout.writefln("hello world"); return 0; }
Jan 31 2005
parent "Walter" <newshound digitalmars.com> writes:
"Ben Hinkle" <ben.hinkle gmail.com> wrote in message
news:ctmrou$2aol$1 digitaldaemon.com...
 already done.
doh! You're right.
Jan 31 2005
prev sibling parent "Carlos Santander B." <csantander619 gmail.com> writes:
Walter wrote:
 "Carlos Santander B." <csantander619 gmail.com> wrote in message
 news:ctmjp1$23i5$1 digitaldaemon.com...
1. Why is std.c.stdio publicly imported? (notice std.utf and std.format
are private)
Because I viewed std.stdio as extending std.c.stdio, not replacing it.
I'm not sure why, but I kinda feel uneasy about that. I don't know about the rest of the guys. But, if that's what you think, that's what you think.
 
2. std.stdio defines FPUTC et al. Why are they public?
No good reason.
3. Why keep std.c.stdio.FILE instead of using std.stream.Stream? Ok,
maybe for the internal representantion (because writex works with
std.c.stdio), but fwritef/fwritefln (IMHO) should get a Stream, and not
a FILE *. I mean, we're trying to leave C behind, right?
I suggest adding a writef to std.stream.
4. Will we ever see a readf or similar in Phobos?
Yes.
Good! _______________________ Carlos Santander Bernal
Feb 01 2005