www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - What is a stdio module without input capability?

reply Tyro <ridimz yahoo.com> writes:
Answer: std.stdio! About as incomplete and undesirable as they come.

IMNSHO this is a feature that is long overdue. Why exactly do I need 
call upon two separate modules to get the functionality promised in one? 
Can we please get a complete stdio module. I know this is about the last 
thing on the minds of professionals lurking here in D-dom, but for some 
(myself included) it is still very important.

import std.stdio: writef;
import std.cstream: din;

writef("Something important!\n");
din.readf(&someInput);

Yes, it is trivial. Yes, it can be accomplished. But it is unintuitive 
and certainly not what is promised by a "stdio" module.

And while we are on the subject! I know printf() holds a place near and 
dear to the hearts of all those who've ever used it. But since this is D 
and not C, doesn't the D io routines deserve at least the same 
privileges the C ones do? Is their anyway that we can have 
writef()/writefln() take the place of printf() in the object module? 
Barring that, can they at least be included alongside the great printf()?

Andrew C. Edwards
Jul 29 2006
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Tyro" <ridimz yahoo.com> wrote in message 
news:eafemu$6mc$1 digitaldaemon.com...
 Answer: std.stdio! About as incomplete and undesirable as they come.

 IMNSHO this is a feature that is long overdue. Why exactly do I need call 
 upon two separate modules to get the functionality promised in one? Can we 
 please get a complete stdio module. I know this is about the last thing on 
 the minds of professionals lurking here in D-dom, but for some (myself 
 included) it is still very important.

 import std.stdio: writef;
 import std.cstream: din;

 writef("Something important!\n");
 din.readf(&someInput);

 Yes, it is trivial. Yes, it can be accomplished. But it is unintuitive and 
 certainly not what is promised by a "stdio" module.
Meh, if you're so worried about using one module, just always use std.cstream : dout, din. If nothing else, it's more consistent. dout.writefln("Something important!"); din.readf(&someInput); Personally I think merging std.stdio and std.cstream would make sense, since then writef[ln] would just become shims for calling dout.writef[ln], and there would be readf as a shim for din.readf.
 And while we are on the subject! I know printf() holds a place near and 
 dear to the hearts of all those who've ever used it. But since this is D 
 and not C, doesn't the D io routines deserve at least the same privileges 
 the C ones do? Is their anyway that we can have writef()/writefln() take 
 the place of printf() in the object module? Barring that, can they at 
 least be included alongside the great printf()?
I hate printf and I hope it dies and is never used all over the phobos source again.
Jul 29 2006
parent Tyro <ridimz yahoo.com> writes:
Jarrett Billingsley wrote:
 "Tyro" <ridimz yahoo.com> wrote in message 
 news:eafemu$6mc$1 digitaldaemon.com...
 Answer: std.stdio! About as incomplete and undesirable as they come.

 IMNSHO this is a feature that is long overdue. Why exactly do I need call 
 upon two separate modules to get the functionality promised in one? Can we 
 please get a complete stdio module. I know this is about the last thing on 
 the minds of professionals lurking here in D-dom, but for some (myself 
 included) it is still very important.

 import std.stdio: writef;
 import std.cstream: din;

 writef("Something important!\n");
 din.readf(&someInput);

 Yes, it is trivial. Yes, it can be accomplished. But it is unintuitive and 
 certainly not what is promised by a "stdio" module.
Meh, if you're so worried about using one module, just always use std.cstream : dout, din. If nothing else, it's more consistent.
Nah! I'm not really worried about using multiple packages. I've been doing it for four years and can continue for another forty. My complaint is that the "standard" input/output module should facilitate both input and output as its name implies. If there is no intent on providing both functionalities, simply rename the module to std.stdout or std.output (or anything more indicative of its content) so the user knows exactly what [s]he's getting by importing such a module.
 dout.writefln("Something important!");
 din.readf(&someInput);
 
 Personally I think merging std.stdio and std.cstream would make sense, since 
 then writef[ln] would just become shims for calling dout.writef[ln], and 
 there would be readf as a shim for din.readf.
Not a bad idea at all. But to be quite honest, as long as the solution is complete, consistent, and intuitive, I don't rightly care how it is implemented.
 And while we are on the subject! I know printf() holds a place near and 
 dear to the hearts of all those who've ever used it. But since this is D 
 and not C, doesn't the D io routines deserve at least the same privileges 
 the C ones do? Is their anyway that we can have writef()/writefln() take 
 the place of printf() in the object module? Barring that, can they at 
 least be included alongside the great printf()?
I hate printf and I hope it dies and is never used all over the phobos source again.
Couldn't agree more! -- Andrew C. Edwards ----------------------------------------------------- The truth we call D, has passed through three stages: First, it was ridiculed; Then, it was violently opposed; and And now, it is being accepted as self-evident. Consequently: C/C++ is rapidly approaching Stage 5 (being forgotten)!
Jul 29 2006