On Mon, 04 May 2015 00:07:25 +0000, Freddy wrote: > Would it be a bad idea to add a read primitive to ranges for streaming? > ---- > struct ReadRange(T){ > size_t read(T[] buffer); //and | or T[] read(size_t request); > > /+ empty,front,popFront,etc +/ > } > ----
if you want to add such things, i'd say you should model that by `std.stdio.File` (`rawRead`, `rawWrite` and other file functions). i'm using my `streams` module that uses such interfaces for a long time. can't see why it should be range, though. i introduced "Stream" entity, which, like range, can be checked with various traits: isReadableStream, isWriteableStream, isSeekableStream and so on. note that stream can be range too, that's completely different interfaces. what is good with taking `std.stdio.File` as a base -- all my stream operations immediately usable on standard file objects from Phobos.
signature.asc
Description: PGP signature