On 5/14/2012 8:02 AM, Steven Schveighoffer wrote:
I keep trying to avoid talking about this, because I'm writing a replacement
library for std.stream, and I don't want to step on any toes while it's still
not accepted.
But I have to say, ranges are *not* a good interface for generic data providers.
They are *very* good for structured data providers.
In other words, a stream of bytes, not a good range (who wants to get one byte
at a time?). A stream of UTF text broken into lines, a very good range.
I have no problem with getting rid of std.stream. I've never actually used it.
Still, we absolutely need a non-range based low-level streaming interface to
data. If nothing else, we need something we can build ranges upon, and I think
my replacement does a very good job of that.
I'll say in advance without seeing your design that it'll be a tough sell if it
is not range based.
I've been doing some range based work on the side. I'm convinced there is
enormous potential there, despite numerous shortcomings with them I ran across
in Phobos. Those shortcomings can be fixed, they are not fatal.
The ability to do things like:
void main() {
stdin.byChunk(1024).
map!(a => a.idup). // one of those shortcomings
joiner().
stripComments().
copy(stdout.lockingTextWriter());
}
is just kick ass.