On 7/31/20 5:20 AM, WebFreak001 wrote:
On Sunday, 26 July 2020 at 17:09:07 UTC, Steven Schveighoffer wrote:
I have released a minor improvement to std.io [1], which adds support
for opening the standard handles (stdin, stdout, stderr) [2].
In order to make this work, I also had to add a feature to IOs that
allows you to temporarily use a file descriptor/handle [3].
As of now, it hasn't updated on code.dlang.org, but it should be soon.
With this, I'm going to focus next on making an iopipe/io layer that
can replace write[f]ln and friends.
[1] https://code.dlang.org/packages/io
[2] https://martinnowak.github.io/io/std/io/driver.html
[3] https://martinnowak.github.io/io/std/io/file/File.this.html
very cool, will this replace std.stdio? Will there be an API similar to
the old one for upgrading?
I should clarify that when I say "replace" I mean become a viable choice
to replace usage in user code. I don't think Phobos will move away from
its current design.
The hope is that it's written well enough that it could be the basis for
low-level i/o in D 3rd party projects. For example, I'd love to see
projects like vibe.d and hunt fit together on the same i/o subsystem.
Then you can pick whichever library you want, or use multiple libraries,
and they all work together with the same i/o framework.
std.stdio is a one-stop-shop for one specific i/o implementation (C's
FILE * i/o). I don't know if there's a way to replace it. I have thought
of it in the past, and the issues are hairy.
I know on Windows low level Console output is very different from File
output, is a console API in scope for std.io or would that rather be a
new module? It could also handle code page setup and console mode and
stuff there.
Doing console programming might fit in this library, but there is
nothing there yet. If you have ideas, please start a github issue on it.
I still need to add pipes, and unix sockets.
-Steve