Stream mixins?

Janice Caron caron800 at googlemail.com
Sat Nov 10 12:55:56 PST 2007


Hi, Walter, I just had a good idea. (Well, I think it's a good idea!)

Please could you separate out the member functions of
std.stream.Stream into three mixins: ReadMixin, WriteMixin and
SeekMixin?

ReadMixin to include every read function except readBlock()
WriteMixin to include every write function except writeBlock()
SeekMixin to include every seek function.

Then you could implement Stream by mixing in the mixins.

More importantly, I could write

class MyOutputStream : OutputStream
{
    this() { writeable = true; }
    uint writeBlock(const const void* buffer, uint size) { /*...*/ }
    mixin WriteMixin;
}

instead of having to derive from Stream (I don't want an input stream)
or implement writefln()



More information about the Digitalmars-d mailing list