An IO Streams Library

Rikki Cattermole via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 6 19:23:12 PST 2016


On 07/02/16 3:43 PM, Jason White wrote:
> On Sunday, 7 February 2016 at 01:59:43 UTC, Rikki Cattermole wrote:
>> Actually I think there are plenty of use cases not implemented.
>> Done properly as a full replacement and rework of Phobos will mean you
>> need to do almost everything in e.g. std.stdio and std.socket but with
>> better abstractions.
>
> I think I'll tackle implementing sockets next. I might need that for
> another project of mine.

I wouldn't actually implement it based upon std.socket.
Use libasync instead.
https://github.com/etcimon/libasync

There has been talk about getting that into Phobos but it still needs 
time to mature.

One other important thing to note about sockets.
For anything performance related you need to have a central way to 
implement an event loop.

The one I've implemented is designed to work as a replacement for 
libasync's and to be used in Phobos.
https://github.com/rikkimax/alphaPhobos/blob/master/source/std/experimental/platform.d

If you do intend to make it compatible, you can ignore all of the 
windowing and related methods. Just keep things like optimizedEventLoop, 
eventLoopIteration, setAsDefault and thePlatform, defaultPlatform all in 
there.

We can combine later on, I just want it to be compatible when it comes time.

> Once this gets polished enough, it would be great to eventually replace
> those modules in Phobos. However, it would be difficult to do this
> without compatibility breakages. For example, since std.stdio.File uses
> FILE* under the covers and this uses plain old file descriptors,
> programs that rely on that behavior would break.

There is nothing wrong with breakage. Its old code. Its time to update.
But there must be a clear upgrade path.

>> Of course your goal may not be inline with my assertions of reworking
>> Phobos. So feel free to ignore, it just would be a shame since it
>> really needs some love.
>
> My primary goal is to provide a more useful and powerful IO library than
> what Phobos provides since that is what I need for my other projects.
> That goal is not necessarily counter to reworking Phobos. ;)

Okay sweet. Also if you can, it would be great to see you on IRC.


More information about the Digitalmars-d mailing list