Stream mixins?
Kris
foo at bar.com
Sat Nov 10 15:12:50 PST 2007
This is a fair example of why Tango does things differently. The I/O stream
are discrete, they have interfaces for cases where inheritance won't
suffice, and Seekable is a trivial interface.
"Janice Caron" <caron800 at googlemail.com> wrote in message
news:mailman.31.1194728178.2338.digitalmars-d at puremagic.com...
> 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