Thread overview
phobos io modules
May 28, 2005
Ben Hinkle
May 28, 2005
Ben Hinkle
May 29, 2005
Andrew Fedoniouk
May 29, 2005
Ben Hinkle
May 31, 2005
Ben Hinkle
May 28, 2005
Here are some ideas to make the io sitution more obvious to people. Basically follow what C++ does and move std.stdio to std.cstdio and make a std.cstream that wraps a FILE* in a CFile (or something like that) and have std.c.stdio.stdin/out/err wrappers. So there would be three "stdin" apis: std.c.stdio.stdin, std.cstream.stdin and std.stream.stdin (plus the platform-specific apis in std.c.windows.windows etc). Same goes for stdout and stderr. The semantics of FILE* is slightly different than Stream so it could be problematic replacing one with the other. D will differ from C++ in usage, though, since std.cstdio will be used much more often than in C++ code.

ps - sorry if this post is sent twice - the one I sent earlier didn't seem to come through.


May 28, 2005
>So there would be three "stdin" apis:
>std.c.stdio.stdin, std.cstream.stdin and std.stream.stdin (plus the
>platform-specific apis in std.c.windows.windows etc). Same goes for stdout and
>stderr.

a clarificatoin: since cstream would publically import std.cstdio the wrappers of stdin and friends would have to have different names.


May 29, 2005
what about following:
each D application has singleton declared as

class self // in Harmonia it is Application
{
   static:
      char[][] commandLine;
      char[]    path;

      istream   input;
      ostream  output;
}

and forget about std.c.stdio.stdin and other inhabitants of the zoo?

Andrew.


"Ben Hinkle" <Ben_member@pathlink.com> wrote in message news:d7aisb$18no$1@digitaldaemon.com...
> Here are some ideas to make the io sitution more obvious to people.
> Basically
> follow what C++ does and move std.stdio to std.cstdio and make a
> std.cstream
> that wraps a FILE* in a CFile (or something like that) and have
> std.c.stdio.stdin/out/err wrappers. So there would be three "stdin" apis:
> std.c.stdio.stdin, std.cstream.stdin and std.stream.stdin (plus the
> platform-specific apis in std.c.windows.windows etc). Same goes for stdout
> and
> stderr. The semantics of FILE* is slightly different than Stream so it
> could be
> problematic replacing one with the other. D will differ from C++ in usage,
> though, since std.cstdio will be used much more often than in C++ code.
>
> ps - sorry if this post is sent twice - the one I sent earlier didn't seem
> to
> come through.
>
> 


May 29, 2005
In article <d7c12l$287a$1@digitaldaemon.com>, Andrew Fedoniouk says...
>
>what about following:
>each D application has singleton declared as
>
>class self // in Harmonia it is Application
>{
>   static:
>      char[][] commandLine;
>      char[]    path;
>
>      istream   input;
>      ostream  output;
>}
>
>and forget about std.c.stdio.stdin and other inhabitants of the zoo?

Isn't that just adding another animal to the zoo? The zoo in question is "how many ways are there to print something to standard out"? I don't see how self.input (or generally class.name) are much different than package.name - fewer characters?


May 31, 2005
"Andrew Fedoniouk" <news@terrainformatica.com> wrote in message news:d7c12l$287a$1@digitaldaemon.com...
> what about following:
> each D application has singleton declared as
>
> class self // in Harmonia it is Application
> {
>   static:
>      char[][] commandLine;
>      char[]    path;
>
>      istream   input;
>      ostream  output;
> }
>
> and forget about std.c.stdio.stdin and other inhabitants of the zoo?
>
> Andrew.

some more names that come to mind:

std.cstream: wrappers around std.c.stdio
CFile cstdin, cstdout, cstderr

std.stream: wraps OS file api
File dstdin, dstdout, dstderr

I'm guessing that std.stdio will remain unchanged.