Thread overview
4 Qs about std.stdio
Feb 01, 2005
Walter
Feb 01, 2005
Ben Hinkle
Feb 01, 2005
Walter
February 01, 2005
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
February 01, 2005
"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


February 01, 2005
>> 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;
}


February 01, 2005
"Ben Hinkle" <ben.hinkle@gmail.com> wrote in message news:ctmrou$2aol$1@digitaldaemon.com...
> already done.

doh! You're right.


February 01, 2005
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